diff util.py @ 152:1fde85a10f9e

push: Fix the bad implementation that required modifying the dirstate to push.
author Augie Fackler <durin42@gmail.com>
date Mon, 22 Dec 2008 21:22:11 -0600
parents 9ffde8662967
children 6fa97cfbf62f
line wrap: on
line diff
--- a/util.py
+++ b/util.py
@@ -82,23 +82,21 @@ class PrefixMatch(object):
     def __call__(self, fn):
         return fn.startswith(self.p)
 
-def outgoing_revisions(ui, repo, hg_editor, reverse_map):
+def outgoing_revisions(ui, repo, hg_editor, reverse_map, sourcerev):
     """Given a repo and an hg_editor, determines outgoing revisions for the
     current working copy state.
     """
     outgoing_rev_hashes = []
-    working_rev = repo.parents()
-    assert len(working_rev) == 1
-    working_rev = working_rev[0]
-    if working_rev.node() in reverse_map:
+    if sourcerev in reverse_map:
         return
-    while (not working_rev.node() in reverse_map
-           and working_rev.node() != node.nullid):
-        outgoing_rev_hashes.append(working_rev.node())
-        working_rev = working_rev.parents()
-        assert len(working_rev) == 1
-        working_rev = working_rev[0]
-    if working_rev.node() != node.nullid:
+    sourcerev = repo[sourcerev]
+    while (not sourcerev.node() in reverse_map
+           and sourcerev.node() != node.nullid):
+        outgoing_rev_hashes.append(sourcerev.node())
+        sourcerev = sourcerev.parents()
+        assert len(sourcerev) == 1
+        sourcerev = sourcerev[0]
+    if sourcerev.node() != node.nullid:
         return outgoing_rev_hashes