changeset 85:05a0c4f6060f

push_cmd: consider only dirs with added/removed files for addition or deletion
author Patrick Mezard <pmezard@gmail.com>
date Fri, 14 Nov 2008 16:18:24 -0600
parents 01e747937d35
children 6ecdbd22eb1d
files push_cmd.py tests/test_push_dirs.py
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/push_cmd.py
+++ b/push_cmd.py
@@ -103,12 +103,16 @@ def _getdirchanges(svn, branchpath, pare
         return dirs
 
     deleted, added = [], []
-    if not changedfiles:
-        return added, deleted
     changeddirs = {}
     for f in changedfiles:
+        if f in parentctx and f in ctx:
+            # Updated files cannot cause directories to be created
+            # or removed.
+            continue
         for d in finddirs(f):
             changeddirs[d] = 1
+    if not changeddirs:
+        return added, deleted
     olddirs = getctxdirs(parentctx, changeddirs)
     newdirs = getctxdirs(ctx, changeddirs)
 
--- a/tests/test_push_dirs.py
+++ b/tests/test_push_dirs.py
@@ -27,6 +27,15 @@ class TestPushDirectories(test_util.Test
                            'd31/d32', 'd31/d32/a', 'd31/d32/d33', 
                            'd31/d32/d33/d34', 'd31/d32/d33/d34/a'])
 
+        # Add one revision with changed files only, no directory addition
+        # or deletion.
+        changes = [
+            ('d1/a', 'd1/a', 'aa\n'),
+            ('d2/a', 'd2/a', 'aa\n'),
+            ]
+        self.commitchanges(changes)
+        self.pushrevisions()
+
         changes = [
             # Remove single file in single directory
             ('d1/a', None, None),