# HG changeset patch # User Patrick Mezard # Date 1230690843 21600 # Node ID f244eaee506999863fcdea45ac8db3034db89ca6 # Parent 84fbf1469a3120c3d2bbec8a50f7a23516a6cfc6 push_cmd: make _isdir() a standalone function diff --git a/push_cmd.py b/push_cmd.py --- a/push_cmd.py +++ b/push_cmd.py @@ -91,6 +91,13 @@ def push_revisions_to_subversion(ui, rep 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. @@ -102,13 +109,6 @@ def _getdirchanges(svn, branchpath, pare 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: @@ -140,11 +140,11 @@ def _getdirchanges(svn, branchpath, pare 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