[PATCH] transaction-summary: show phase changes statistics in pull/unbundle

Denis Laxalde denis at laxalde.org
Thu May 24 09:48:01 EDT 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1527157190 -7200
#      Thu May 24 12:19:50 2018 +0200
# Node ID 48bc12fc4aee84bffa539f9ced452e6c686a53e4
# Parent  37ef6ee87488ac0095f8dedf75284f64d1d54455
# Available At http://hg.logilab.org/users/dlaxalde/hg
#              hg pull http://hg.logilab.org/users/dlaxalde/hg -r 48bc12fc4aee
# EXP-Topic pull-info-transaction
transaction-summary: show phase changes statistics in pull/unbundle

Upon pull or unbundle, we display a message with the number of
changesets which phase became public. Noticeably, this new message would
appear even if no new changeset were added (below the "no changes found"
message), thus indicating that something actually happened to the local
repository.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1482,6 +1482,24 @@ def registersummarycallback(repo, otr, t
                 revrange = '%s:%s' % (minrev, maxrev)
             repo.ui.status(_('new changesets %s\n') % revrange)
 
+        @reportsummary
+        def reportphasechanges(repo, tr):
+            """Report statistics of phase changes for changesets pre-existing
+            pull/unbundle.
+            """
+            newrevs = tr.changes.get('revs', xrange(0, 0))
+            phasetracking = tr.changes.get('phases', {})
+            if not phasetracking:
+                return
+            published = [
+                rev for rev, (old, new) in phasetracking.iteritems()
+                if new == phases.public and rev not in newrevs
+            ]
+            if not published:
+                return
+            repo.ui.status(_('%d changesets became public\n')
+                           % len(published))
+
 def nodesummaries(repo, nodes, maxnumnodes=4):
     if len(nodes) <= maxnumnodes or repo.ui.verbose:
         return ' '.join(short(h) for h in nodes)
diff --git a/tests/test-bundle-r.t b/tests/test-bundle-r.t
--- a/tests/test-bundle-r.t
+++ b/tests/test-bundle-r.t
@@ -156,6 +156,7 @@
   adding file changes
   added 4 changesets with 2 changes to 3 files (+1 heads)
   new changesets c70afb1ee985:faa2e4234c7a
+  1 changesets became public
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg verify
   checking changesets
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -150,6 +150,7 @@ pull empty (with phase movement)
   pulling from $TESTTMP/main
   no changes found
   pre-close-tip:24b6387c8c8c public 
+  1 changesets became public
   postclose-tip:24b6387c8c8c public 
   txnclose hook: HG_HOOKNAME=txnclose.env HG_HOOKTYPE=txnclose HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_TXNNAME=pull
   file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -129,6 +129,7 @@ changes. If this output changes, we coul
   adding file changes
   added 1 changesets with 1 changes to 1 files
   new changesets aaff8d2ffbbf
+  1 changesets became public
 
 Incremental pull doesn't fetch bundle
 
@@ -201,6 +202,7 @@ by old clients.
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Feature works over SSH
 
@@ -213,6 +215,7 @@ Feature works over SSH
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Entry with unknown BUNDLESPEC is filtered and not used
 
@@ -232,6 +235,7 @@ Entry with unknown BUNDLESPEC is filtere
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Automatic fallback when all entries are filtered
 
@@ -269,6 +273,7 @@ Python 2.7.9+ support SNI
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 #else
 Python <2.7.9 will filter SNI URLs
 
@@ -373,6 +378,7 @@ Preferring an undefined attribute will t
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Preferring bz2 type will download first entry of that type
 
@@ -385,6 +391,7 @@ Preferring bz2 type will download first 
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Preferring multiple values of an option works
 
@@ -397,6 +404,7 @@ Preferring multiple values of an option 
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Sorting multiple values should get us back to original first entry
 
@@ -409,6 +417,7 @@ Sorting multiple values should get us ba
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Preferring multiple attributes has correct order
 
@@ -421,6 +430,7 @@ Preferring multiple attributes has corre
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Test where attribute is missing from some entries
 
@@ -440,6 +450,7 @@ Test where attribute is missing from som
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
 
 Test interaction between clone bundles and --stream
 
@@ -545,3 +556,4 @@ Test clone bundle retrieved through bund
   finished applying clone bundle
   searching for changes
   no changes found
+  2 changesets became public
diff --git a/tests/test-convert.t b/tests/test-convert.t
--- a/tests/test-convert.t
+++ b/tests/test-convert.t
@@ -419,6 +419,7 @@
   pulling from ../a
   searching for changes
   no changes found
+  5 changesets became public
 
 conversion to existing file should fail
 
diff --git a/tests/test-flags.t b/tests/test-flags.t
--- a/tests/test-flags.t
+++ b/tests/test-flags.t
@@ -46,6 +46,7 @@ the changelog should mention file a:
   adding file changes
   added 1 changesets with 0 changes to 0 files (+1 heads)
   new changesets 7f4313b42a34
+  1 changesets became public
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg heads
   changeset:   2:7f4313b42a34
diff --git a/tests/test-merge6.t b/tests/test-merge6.t
--- a/tests/test-merge6.t
+++ b/tests/test-merge6.t
@@ -42,6 +42,7 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets b90e70beeb58
+  1 changesets became public
   (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg merge
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -80,6 +80,7 @@ setup
   pulling from $TESTTMP/remote
   searching for changes
   no changes found
+  1 changesets became public
   $ hg log -G --hidden
   @  71e3228bffe1 (draft) add new
   |
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -167,6 +167,7 @@ update must update phase of common chang
   pulling from ../alpha
   searching for changes
   no changes found
+  1 changesets became public
   test-debug-phase: move rev 2: 1 -> 0
   $ hgph
   o  4 public a-D - b555f63b6063
@@ -283,6 +284,7 @@ we are in nu
   adding file changes
   added 1 changesets with 1 changes to 1 files
   new changesets b555f63b6063
+  3 changesets became public
   test-debug-phase: move rev 0: 1 -> 0
   test-debug-phase: move rev 1: 1 -> 0
   test-debug-phase: move rev 2: 1 -> 0
@@ -331,6 +333,7 @@ pulling from Publish=False to publish=Fa
   adding file changes
   added 2 changesets with 2 changes to 2 files
   new changesets d6bcb4f74035:145e75495359
+  4 changesets became public
   test-debug-phase: move rev 0: 1 -> 0
   test-debug-phase: move rev 1: 1 -> 0
   test-debug-phase: move rev 3: 1 -> 0
@@ -404,6 +407,7 @@ pulling back into original repo
   pulling from ../alpha
   searching for changes
   no changes found
+  3 changesets became public
   test-debug-phase: move rev 3: 1 -> 0
   test-debug-phase: move rev 5: 1 -> 0
   test-debug-phase: move rev 6: 1 -> 0
diff --git a/tests/test-pull-branch.t b/tests/test-pull-branch.t
--- a/tests/test-pull-branch.t
+++ b/tests/test-pull-branch.t
@@ -170,6 +170,7 @@ Pull branchC from tt
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 7d8ffa4c0b22
+  13 changesets became public
   (run 'hg heads' to see heads)
 
 Make changes on default and branchC on tt
@@ -183,6 +184,7 @@ Make changes on default and branchC on t
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 2b94b54b6b5f
+  1 changesets became public
   (run 'hg heads' to see heads)
   $ hg up -C default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -219,6 +221,7 @@ Pull from tt
   adding file changes
   added 2 changesets with 2 changes to 2 files (+2 heads)
   new changesets eed40c14b407:e634733b0309
+  1 changesets became public
   (run 'hg heads .' to see heads, 'hg merge' to merge)
 
   $ cd ..
diff --git a/tests/test-pull-update.t b/tests/test-pull-update.t
--- a/tests/test-pull-update.t
+++ b/tests/test-pull-update.t
@@ -27,6 +27,7 @@ Should respect config to disable dirty u
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 107cefe13e42
+  1 changesets became public
   abort: uncommitted changes
   [255]
   $ hg --config extensions.strip= strip --no-backup tip
@@ -58,6 +59,7 @@ Should not update to the other branch:
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 800c91d5bfc1
+  1 changesets became public
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updated to "107cefe13e42: m"
   1 other heads for branch "default"
@@ -80,6 +82,7 @@ Should work:
   adding file changes
   added 1 changesets with 1 changes to 1 files (-1 heads)
   new changesets 483b76ad4309
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Similarity between "hg update" and "hg pull -u" in handling bookmark
@@ -108,6 +111,7 @@ explicit destination of the update.
   added 1 changesets with 1 changes to 1 files
   adding remote bookmark active-after-pull
   new changesets f815b3da6163
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark active-after-pull)
 
@@ -137,6 +141,7 @@ explicit destination of the update.
   added 1 changesets with 1 changes to 1 files
   adding remote bookmark active-after-pull
   new changesets f815b3da6163
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark active-after-pull)
 
@@ -175,6 +180,7 @@ match with the name of any existing book
   adding file changes
   added 2 changesets with 1 changes to 1 files
   new changesets f815b3da6163:b5e4babfaaa7
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark active-before-pull)
 
@@ -202,6 +208,7 @@ match with the name of any existing book
   adding file changes
   added 2 changesets with 1 changes to 1 files
   new changesets f815b3da6163:b5e4babfaaa7
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark active-before-pull)
 
@@ -229,6 +236,7 @@ match with the name of any existing book
   adding file changes
   added 2 changesets with 1 changes to 1 files
   new changesets f815b3da6163:b5e4babfaaa7
+  1 changesets became public
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark active-before-pull)
 
diff --git a/tests/test-rename-after-merge.t b/tests/test-rename-after-merge.t
--- a/tests/test-rename-after-merge.t
+++ b/tests/test-rename-after-merge.t
@@ -36,6 +36,7 @@ Merge repositories:
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets d2ae7f538514
+  1 changesets became public
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
   $ hg merge
diff --git a/tests/test-rename-dir-merge.t b/tests/test-rename-dir-merge.t
--- a/tests/test-rename-dir-merge.t
+++ b/tests/test-rename-dir-merge.t
@@ -219,6 +219,7 @@ Second scenario with two repos:
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   new changesets 7d51ed18da25
+  1 changesets became public
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
   $ hg merge
diff --git a/tests/test-share.t b/tests/test-share.t
--- a/tests/test-share.t
+++ b/tests/test-share.t
@@ -360,6 +360,7 @@ verify that bookmarks are not written on
   searching for changes
   no changes found
   adding remote bookmark bm3
+  1 changesets became public
   $ hg boo
      bm1                       3:b87954705719
    * bm3                       4:62f4ded848e4
diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -31,6 +31,7 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files
   new changesets 30aff43faee1
+  1 changesets became public
   (run 'hg update' to get a working copy)
 
   $ hg verify
diff --git a/tests/test-treediscovery-legacy.t b/tests/test-treediscovery-legacy.t
--- a/tests/test-treediscovery-legacy.t
+++ b/tests/test-treediscovery-legacy.t
@@ -354,6 +354,7 @@ Exercise pushing to server without branc
   pulling from http://localhost:$HGPORT/
   searching for changes
   no changes found
+  1 changesets became public
   $ hg push $remote
   pushing to http://localhost:$HGPORT/
   searching for changes


More information about the Mercurial-devel mailing list