diff cmdutil.py @ 254:9ba31af57e4b

Move utility_commands.find_wc_parent_rev() to cmdutil.parentrev().
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 10 Apr 2009 17:29:45 +0200
parents 28d0ee605308
children 7932d098cb5f
line wrap: on
line diff
--- a/cmdutil.py
+++ b/cmdutil.py
@@ -5,6 +5,7 @@ from mercurial import util as hgutil
 
 from svn import core
 
+import util
 import svnwrap
 import svnexternals
 
@@ -34,6 +35,17 @@ def filterdiff(diff, base_revision):
     return diff
 
 
+def parentrev(ui, repo, hge, svn_commit_hashes):
+    """Find the svn parent revision of the repo's dirstate.
+    """
+    workingctx = repo.parents()[0]
+    outrev = util.outgoing_revisions(ui, repo, hge, svn_commit_hashes,
+                                     workingctx.node())
+    if outrev:
+        workingctx = repo[outrev[-1]].parents()[0]
+    return workingctx
+
+
 def replay_convert_rev(hg_editor, svn, r):
     hg_editor.set_current_rev(r)
     svn.get_replay(r.revnum, hg_editor)