Patchwork [3,of,4] bundlerepo: retract phase boundary

login
register
mail settings
Submitter Eric Sumner
Date Dec. 19, 2014, 9:40 p.m.
Message ID <449efb8e20984980511c.1419025211@dev911.prn1.facebook.com>
Download mbox | patch
Permalink /patch/7186/
State Accepted
Headers show

Comments

Eric Sumner - Dec. 19, 2014, 9:40 p.m.
# HG changeset patch
# User Eric Sumner <ericsumner@fb.com>
# Date 1418934163 28800
#      Thu Dec 18 12:22:43 2014 -0800
# Node ID 449efb8e20984980511cc2c5d277e519a44ce4d9
# Parent  d4c1fc4f348ca996a035c160484d84b4863344c0
bundlerepo: retract phase boundary

This patch makes bundrepo retract the phase boundary for new commits to 'draft'
status, which is consistent with the behavior of 'hg unbundle'.  The old
behavior was for commits to appear with the same phase as their nearest
ancestor in the base repository.

This affects several classes of operation:

* Inspecting a bundle with the -B flag
* Treating a bundle file as a peer (old: everything public, new: everything draft)
* Incoming command (neither old or new behavior is sensible -- fixed in next patch)

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -242,6 +242,10 @@ 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
 
+        self.firstnewrev = self.changelog.repotiprev + 1
+        phases.retractboundary(self, None, phases.draft,
+                               [ctx.node() for ctx in self[self.firstnewrev:]])
+
     @localrepo.unfilteredpropertycache
     def _phasecache(self):
         return bundlephasecache(self, self._phasedefaults)
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -268,51 +268,60 @@ 
 
 Log -R full.hg in partial
 
-  $ hg -R bundle://../full.hg log
+  $ hg -R bundle://../full.hg log -T phases
   changeset:   8:aa35859c02ea
   tag:         tip
+  phase:       draft
   parent:      3:eebf5a27f8ca
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     0.3m
   
   changeset:   7:a6a34bfa0076
+  phase:       draft
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1.3m
   
   changeset:   6:7373c1169842
+  phase:       draft
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1.3
   
   changeset:   5:1bb50a9436a7
+  phase:       draft
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1.2
   
   changeset:   4:095197eb4973
+  phase:       draft
   parent:      0:f9ee2f85a263
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     1.1
   
   changeset:   3:eebf5a27f8ca
+  phase:       public
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     0.3
   
   changeset:   2:e38ba6f5b7e0
+  phase:       public
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     0.2
   
   changeset:   1:34c2bf6b0626
+  phase:       public
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     0.1
   
   changeset:   0:f9ee2f85a263
+  phase:       public
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     0.0
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -585,10 +585,8 @@ 
 Commit and show expansion in original and copy
 
   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache (served): tip differs
   c
    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
-  invalid branchheads cache (served): tip differs
   overwriting c expanding keywords
   committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
   $ cat a c
@@ -757,22 +755,8 @@ 
 
 Commit with multi-line message and custom expansion
 
-|Note:
-|
-| After the last rollback, the "served" branchheads cache became invalid, but
-| all changesets in the repo were public. For filtering this means:
-|   "immutable" == "served" == ΓΈ.
-|
-| As the "served" cache is invalid, we fall back to the "immutable" cache. But
-| no update is needed between "immutable" and "served" and the "served" cache
-| is not updated on disk. The on-disk version therefore stays invalid for some
-| time. This explains why the "served" branchheads cache is detected as
-| invalid here.
-
   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache (served): tip differs
   a
-  invalid branchheads cache (served): tip differs
   overwriting a expanding keywords
   committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
   $ rm log
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -702,7 +702,7 @@ 
   $ hg incoming http://localhost:$HGPORT
   comparing with http://localhost:$HGPORT/
   searching for changes
-  1:3816541e5485 (public) [tip ] A
+  1:3816541e5485 (draft) [tip ] A
   $ hg outgoing http://localhost:$HGPORT
   comparing with http://localhost:$HGPORT/
   searching for changes
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -143,7 +143,6 @@ 
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd issue4041
-  $ hg phase --draft --force 9
   $ hg log -G
   o    changeset:   10:2f2496ddf49d
   |\   branch:      f1
@@ -316,7 +315,6 @@ 
   adding f1.txt revisions
   files: 1/1 chunks (100.00%)
   added 2 changesets with 2 changes to 1 files
-  removing unknown node e31216eec445 from 1-phase boundary
   invalid branchheads cache (served): tip differs
   rebase completed
   updating the branch cache