Commits

Patrick Mézard committed f244eae

push_cmd: make _isdir() a standalone function

Comments (0)

Files changed (1)

     merc_util._encoding = oldencoding
     return 0
 
+def _isdir(svn, branchpath, svndir):
+    try:
+        svn.list_dir('%s/%s' % (branchpath, svndir))
+        return True
+    except core.SubversionException:
+        return False
+
 def _getdirchanges(svn, branchpath, parentctx, ctx, changedfiles):
     """Compute directories to add or delete when moving from parentctx
     to ctx, assuming only 'changedfiles' files changed.
     deleted directories are also listed, but item order of undefined
     in either list.
     """
-    def exists(svndir):
-        try:
-            svn.list_dir('%s/%s' % (branchpath, svndir))
-            return True
-        except core.SubversionException:
-            return False
-
     def finddirs(path):
         pos = path.rfind('/')
         while pos != -1:
     newdirs = getctxdirs(ctx, changeddirs)
 
     for d in newdirs:
-        if d not in olddirs and not exists(d):
+        if d not in olddirs and not _isdir(svn, branchpath, d):
             added.append(d)
 
     for d in olddirs:
-        if d not in newdirs and exists(d):
+        if d not in newdirs and _isdir(svn, branchpath, d):
             deleted.append(d)
 
     return added, deleted