You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/07/09 16:46:09 UTC

[whimsy] branch master updated: Fix depth except for symlinks; check depth

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 98ee31a  Fix depth except for symlinks; check depth
98ee31a is described below

commit 98ee31a260c6d0ed839f89b5650983dcc53a73bc
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jul 9 17:46:01 2020 +0100

    Fix depth except for symlinks; check depth
---
 Rakefile | 47 +++++++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/Rakefile b/Rakefile
index bc22023..a5d3178 100644
--- a/Rakefile
+++ b/Rakefile
@@ -142,7 +142,7 @@ namespace :svn do
             end
           end
           svnpath = ASF::SVN.svnurl(name)
-          depth = description['depth']
+          depth = description['depth'] || 'infinity'
           noCheckout = %w(delete skip).include? depth
           if Dir.exist? name
             if noCheckout
@@ -164,8 +164,8 @@ namespace :svn do
             isSymlink = File.symlink?(name) # we don't want to change such checkouts
             Dir.chdir(name) {
               system('svn', 'cleanup')
-              if depth == 'empty' and not isSymlink
-                curdepth = ASF::SVN.getInfoAsHash('.')['Depth'] # not available as separate item
+              unless isSymlink # Don't change depth for symlinks
+                curdepth = ASF::SVN.getInfoAsHash('.')['Depth'] || 'infinity' # not available as separate item
                 if curdepth != depth
                   puts "#{PREFIX} update depth from '#{curdepth}' to '#{depth}'"
                   system('svn', 'update', '--set-depth', depth)
@@ -213,7 +213,6 @@ namespace :svn do
               puts outerr # show what happened last
             }
           else # directory does not exist
-            depth = description['depth'] || 'infinity'
             system('svn', 'checkout', "--depth=#{depth}", svnpath, name)
              if files
                system('svn', 'update', *files, {chdir: name})
@@ -242,28 +241,24 @@ namespace :svn do
           puts
           puts File.join(Dir.pwd, name)
           if Dir.exist? name
-            Dir.chdir(name) {
-              outerr = nil
-                begin
-                  outerr, status = Open3.capture2e('svn info --show-item url')
-                  if status.success?
-                    outerr.chomp!
-                    if outerr.end_with? description['url']
-                       puts "#{outerr} - OK"
-                       break
-                    else
-                       puts "#{outerr} - Error!\nExpected URL to end with:    #{description['url']}"
-                       errors += 1
-                    end
-                    break
-                  end
-                rescue => e
-                  outerr = e.inspect
-                  errors += 1
-                  break
-                end
-              puts outerr # show what happened last
-            }
+            hash, err = ASF::SVN.getInfoAsHash(name)
+            if hash
+              urlact = hash['URL']
+              urlexp = description['url']
+              unless urlact.end_with? urlexp # urlexp is relative only
+                puts "URL: #{urlact} expected to end with #{urlexp}"
+                errors += 1
+              end
+              depthact = hash['Depth'] || 'infinity'
+              depthexp = description['depth'] || 'infinity'
+              unless depthact ==  depthexp
+                puts "Depth: #{depthact} expected to be #{depthexp}"
+                errors += 1
+              end
+            else
+              puts "Error getting details for #{name}: #{err}"
+              errors += 1
+            end
           else
             require 'uri'
             base = URI.parse('https://svn.apache.org/repos/')