[PATCH 3 of 5 REVIEW] phases: marked content of a changegroup as published

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Oct 19 05:27:21 CDT 2011


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1319019552 -7200
# Node ID 678353d217a1b96d3771cac1c6e81ca831d6546b
# Parent  e1395c636c0e7e783e77158f1fb8dc1e610cb209
phases: marked content of a changegroup as published

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1956,10 +1956,12 @@ class localrepository(repo.repository):
                 p = lambda: cl.writepending() and self.root or ""
                 self.hook('pretxnchangegroup', throw=True,
                           node=hex(cl.node(clstart)), source=srctype,
                           url=url, pending=p)
 
+            added = [cl.node(r) for r in xrange(clstart, clend)]
+            phases.moveboundary(self, 0, added)
             # make changelog see real files again
             cl.finalize(trp)
 
             tr.close()
         finally:
@@ -1972,13 +1974,12 @@ class localrepository(repo.repository):
             self.ui.debug("updating the branch cache\n")
             self.updatebranchcache()
             self.hook("changegroup", node=hex(cl.node(clstart)),
                       source=srctype, url=url)
 
-            for i in xrange(clstart, clend):
-                self.hook("incoming", node=hex(cl.node(i)),
-                          source=srctype, url=url)
+            for n in added:
+                self.hook("incoming", node=hex(n), source=srctype, url=url)
 
         # never return 0 here:
         if dh < 0:
             return dh - 1
         else:
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
new file mode 100644
--- /dev/null
+++ b/tests/test-phases-exchange.t
@@ -0,0 +1,58 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > EOF
+  $ alias hgph='hg log --template "{rev} {phase} {desc}\n"'
+
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "$1"
+  > }
+
+  $ hg init alpha
+  $ cd alpha
+  $ mkcommit a-A
+  $ mkcommit a-B
+  $ mkcommit a-C
+  $ mkcommit a-D
+  $ hgph
+  3 1 a-D
+  2 1 a-C
+  1 1 a-B
+  0 1 a-A
+
+  $ hg init ../beta
+  $ hg push -r 1 ../beta
+  pushing to ../beta
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  $ cd ../beta
+  $ hgph
+  1 0 a-B
+  0 0 a-A
+  $ hg up -q
+  $ mkcommit b-A
+  $ hgph
+  2 1 b-A
+  1 0 a-B
+  0 0 a-A
+  $ hg pull ../alpha
+  pulling from ../alpha
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ hgph
+  4 0 a-D
+  3 0 a-C
+  2 1 b-A
+  1 0 a-B
+  0 0 a-A
+
+


More information about the Mercurial-devel mailing list