Mercurial > hgsubversion
diff push_cmd.py @ 173:f244eaee5069
push_cmd: make _isdir() a standalone function
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 30 Dec 2008 20:34:03 -0600 |
parents | b77a4caaf77b |
children | 2412800b1258 |
line wrap: on
line diff
--- 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