changeset 184:d3ea6c98a086

Do not recurse for externals on copied directory in stupid mode We inherit the source externals, changes to children will appear in the changelog.
author Patrick Mezard <pmezard@gmail.com>
date Wed, 14 Jan 2009 23:17:13 -0600
parents 1c46ad3f56aa
children 57355b0e7bd1
files fetch_command.py tests/fixtures/externals.sh tests/fixtures/externals.svndump tests/test_externals.py
diffstat 4 files changed, 69 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_command.py
+++ b/fetch_command.py
@@ -458,7 +458,9 @@ def stupid_fetch_externals(svn, branchpa
                 continue
             path = path[len(branchprefix):]
             dirs.add(path)
-            if e.action == 'M':
+            if e.action == 'M' or (e.action == 'A' and e.copyfrom_path):
+                # Do not recurse in copied directories, changes are marked
+                # as 'M', except for the copied one.
                 continue
             for child, k in svn.list_files(branchprefix + path, r.revnum):
                 if k == 'd':
--- a/tests/fixtures/externals.sh
+++ b/tests/fixtures/externals.sh
@@ -61,6 +61,10 @@ cd ../branches
 svn copy ../trunk branch1
 svn propdel svn:externals branch1/subdir2
 svn ci -m 'externals in subtree'
+# Test branch with externals, removing on copy root
+svn copy ../trunk branch2
+svn propdel svn:externals branch2 branch2/subdir2
+svn ci -m 'externals in subtree, removed on root'
 cd ../trunk
 # Suppress the subdirectory
 svn rm --force subdir
--- a/tests/fixtures/externals.svndump
+++ b/tests/fixtures/externals.svndump
@@ -1,6 +1,6 @@
 SVN-fs-dump-format-version: 2
 
-UUID: b0dd1dbb-3e41-4ee0-8194-38c44cae026b
+UUID: ab7049d2-24fc-4035-b126-5f7012d66a0d
 
 Revision-number: 0
 Prop-content-length: 56
@@ -9,7 +9,7 @@ Content-length: 56
 K 8
 svn:date
 V 27
-2009-01-12T22:58:18.300869Z
+2009-01-12T23:19:30.150669Z
 PROPS-END
 
 Revision-number: 1
@@ -27,7 +27,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:18.364893Z
+2009-01-12T23:19:30.267365Z
 PROPS-END
 
 Node-path: branches
@@ -72,7 +72,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:19.228564Z
+2009-01-12T23:19:31.232927Z
 PROPS-END
 
 Node-path: externals/project1
@@ -132,7 +132,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:20.213824Z
+2009-01-12T23:19:32.212750Z
 PROPS-END
 
 Node-path: trunk
@@ -176,7 +176,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:21.179341Z
+2009-01-12T23:19:33.180250Z
 PROPS-END
 
 Node-path: trunk
@@ -209,7 +209,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:22.266419Z
+2009-01-12T23:19:34.270854Z
 PROPS-END
 
 Node-path: trunk
@@ -269,7 +269,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:25.185874Z
+2009-01-12T23:19:37.185743Z
 PROPS-END
 
 Node-path: branches/branch1
@@ -302,6 +302,48 @@ PROPS-END
 
 
 Revision-number: 7
+Prop-content-length: 139
+Content-length: 139
+
+K 7
+svn:log
+V 37
+externals in subtree, removed on root
+K 10
+svn:author
+V 7
+pmezard
+K 8
+svn:date
+V 27
+2009-01-12T23:19:39.198328Z
+PROPS-END
+
+Node-path: branches/branch2
+Node-kind: dir
+Node-action: add
+Node-copyfrom-rev: 5
+Node-copyfrom-path: trunk
+Prop-content-length: 34
+Content-length: 34
+
+K 13
+svn:mergeinfo
+V 0
+
+PROPS-END
+
+
+Node-path: branches/branch2/subdir2
+Node-kind: dir
+Node-action: change
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+
+Revision-number: 8
 Prop-content-length: 125
 Content-length: 125
 
@@ -316,14 +358,14 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:26.188417Z
+2009-01-12T23:19:40.183807Z
 PROPS-END
 
 Node-path: trunk/subdir
 Node-action: delete
 
 
-Revision-number: 8
+Revision-number: 9
 Prop-content-length: 126
 Content-length: 126
 
@@ -338,7 +380,7 @@ pmezard
 K 8
 svn:date
 V 27
-2009-01-12T22:58:27.183612Z
+2009-01-12T23:19:41.180477Z
 PROPS-END
 
 Node-path: trunk/subdir2
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -73,9 +73,7 @@ class TestFetchExternals(test_util.TestB
         self.assertEqual(ref3, repo[3]['.hgsvnexternals'].data())
 
         ref4 = """\
-[.]
- ^/externals/project2 deps/project2
-[subdir2]
+[subdir]
  ^/externals/project1 deps/project1
 """
         self.assertEqual(ref4, repo[4]['.hgsvnexternals'].data())
@@ -83,9 +81,17 @@ class TestFetchExternals(test_util.TestB
         ref5 = """\
 [.]
  ^/externals/project2 deps/project2
+[subdir2]
+ ^/externals/project1 deps/project1
 """
         self.assertEqual(ref5, repo[5]['.hgsvnexternals'].data())
 
+        ref6 = """\
+[.]
+ ^/externals/project2 deps/project2
+"""
+        self.assertEqual(ref6, repo[6]['.hgsvnexternals'].data())
+
     def test_externals_stupid(self):
         self.test_externals(True)