changeset 15484:a44446ff9ad8

phases: marked content of a changegroup as published
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 11 Nov 2011 00:19:00 +0100
parents 9ae766f2f452
children fa47291b3f1f
files mercurial/localrepo.py tests/test-phases-exchange.t
diffstat 2 files changed, 63 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Nov 11 00:15:22 2011 +0100
+++ b/mercurial/localrepo.py	Fri Nov 11 00:19:00 2011 +0100
@@ -1978,6 +1978,9 @@
                           node=hex(cl.node(clstart)), source=srctype,
                           url=url, pending=p)
 
+            added = [cl.node(r) for r in xrange(clstart, clend)]
+            if srctype != 'strip':
+                phases.advanceboundary(self, 0, added)
             # make changelog see real files again
             cl.finalize(trp)
 
@@ -1994,9 +1997,8 @@
             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:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-phases-exchange.t	Fri Nov 11 00:19:00 2011 +0100
@@ -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
+
+