Patchwork D9262: templates: include all non-branch namespaces in default one-line summary

login
register
mail settings
Submitter phabricator
Date Oct. 29, 2020, 4:07 p.m.
Message ID <differential-rev-PHID-DREV-lpccjj4e2jlyykcdfrjz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47533/
State Superseded
Headers show

Comments

phabricator - Oct. 29, 2020, 4:07 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I left out branches and custom namespaces on purpose from D9252 <https://phab.mercurial-scm.org/D9252>
  because I figured that people like us (Google) who have custom
  namespaces can also have custom configs. However, I just realized that
  this makes everyone with the topic extension lose the topic they've
  had in rebase output for a long time (ever since someone was nice
  enough to add it in D741 <https://phab.mercurial-scm.org/D741>). Sorry about the churn.
  
  The more generic template couldn't easily keep the "log.bookmark"
  label in the template because the namespace is called "bookmarks"
  (plural). That means that we can't be compatible with users' existing
  configs for "log.bookmark", so I decided to change the labels to be in
  a brand-new "oneline-summary" namespace.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9262

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-bookmarks-rebase.t
  tests/test-rebase-abort.t
  tests/test-rebase-bookmarks.t
  tests/test-rebase-collapse.t
  tests/test-rebase-emptycommit.t
  tests/test-rebase-obsolete.t
  tests/test-rebase-templates.t
  tests/test-remotefilelog-bgprefetch.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-remotefilelog-bgprefetch.t b/tests/test-remotefilelog-bgprefetch.t
--- a/tests/test-remotefilelog-bgprefetch.t
+++ b/tests/test-remotefilelog-bgprefetch.t
@@ -229,7 +229,7 @@ 
 .. flaky, the core the test is checked when checking the cache dir, so
 .. hopefully this flakyness is not hiding any actual bug.
   $ hg rebase -s temporary -d foo
-  rebasing 3:d9cf06e3b5b6 tip temporary "b"
+  rebasing 3:d9cf06e3b5b6 temporary tip "b"
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/d9cf06e3b5b6-e5c3dc63-rebase.hg
   ? files fetched over ? fetches - (? misses, 0.00% hit ratio) over *s (glob)
   $ find $CACHEDIR -type f | sort
diff --git a/tests/test-rebase-templates.t b/tests/test-rebase-templates.t
--- a/tests/test-rebase-templates.t
+++ b/tests/test-rebase-templates.t
@@ -100,3 +100,24 @@ 
   rebasing override: 7
   note: not rebasing override: 7, its destination already has all its changes
   dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
+
+
+check namespaces and coloring (labels)
+
+  $ hg tag -l -r 7 my-tag
+  $ hg rebase -r 7 -d 8 -n
+  starting dry-run rebase; repository will not be changed
+  rebasing 7:f48cd65c6dc3 my-tag "Added b"
+  note: not rebasing 7:f48cd65c6dc3 my-tag "Added b", its destination already has all its changes
+  dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
+  $ hg bookmark -r 7 my-bookmark
+  $ hg rebase -r 7 -d 8 -n
+  starting dry-run rebase; repository will not be changed
+  rebasing 7:f48cd65c6dc3 my-bookmark my-tag "Added b"
+  note: not rebasing 7:f48cd65c6dc3 my-bookmark my-tag "Added b", its destination already has all its changes
+  dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
+  $ hg rebase -r 7 -d 8 -n --color=debug
+  [ ui.status|starting dry-run rebase; repository will not be changed]
+  [ ui.status|rebasing [oneline-summary.changeset|7:f48cd65c6dc3] [oneline-summary.bookmarks|my-bookmark] [oneline-summary.tags|my-tag] "[oneline-summary.desc|Added b]"]
+  [ ui.warning|note: not rebasing [oneline-summary.changeset|7:f48cd65c6dc3] [oneline-summary.bookmarks|my-bookmark] [oneline-summary.tags|my-tag] "[oneline-summary.desc|Added b]", its destination already has all its changes]
+  [ ui.status|dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase]
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -1707,7 +1707,7 @@ 
   $ hg bookmark book -i
   $ hg rebase -r B+D1 -d E
   rebasing 1:112478962961 B "B"
-  note: not rebasing 5:15ecf15e0114 D1 tip book "D1", already in destination as 2:0807738e0be9 D2 "D2"
+  note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2"
   1 new orphan changesets
   $ hg log -G -T '{desc} {bookmarks}'
   @  B book
diff --git a/tests/test-rebase-emptycommit.t b/tests/test-rebase-emptycommit.t
--- a/tests/test-rebase-emptycommit.t
+++ b/tests/test-rebase-emptycommit.t
@@ -82,12 +82,12 @@ 
 "BOOK-D", and "BOOK-E" include changes introduced by "C".
 
   $ hg rebase -s 2 -d E
-  rebasing 2:dc0947a82db8 C BOOK-C "C"
+  rebasing 2:dc0947a82db8 BOOK-C C "C"
   rebasing 3:e7b3f00ed42e BOOK-D "D"
   note: not rebasing 3:e7b3f00ed42e BOOK-D "D", its destination already has all its changes
   rebasing 4:69a34c08022a BOOK-E "E"
   note: not rebasing 4:69a34c08022a BOOK-E "E", its destination already has all its changes
-  rebasing 5:6b2aeab91270 F BOOK-F "F"
+  rebasing 5:6b2aeab91270 BOOK-F F "F"
   saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
   $ hg log -G -T '{rev} {desc} {bookmarks}'
   o  5 F BOOK-F
@@ -143,8 +143,8 @@ 
   note: not rebasing 2:dc0947a82db8 BOOK-C "C", its destination already has all its changes
   rebasing 3:b18e25de2cf5 BOOK-D "D"
   note: not rebasing 3:b18e25de2cf5 BOOK-D "D", its destination already has all its changes
-  rebasing 4:86a1f6686812 E BOOK-E "E"
-  note: not rebasing 4:86a1f6686812 E BOOK-E "E", its destination already has all its changes
+  rebasing 4:86a1f6686812 BOOK-E E "E"
+  note: not rebasing 4:86a1f6686812 BOOK-E E "E", its destination already has all its changes
   saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
   $ hg update null -q
 
@@ -191,11 +191,11 @@ 
   $ hg rebase -r '(A::)-(B::)-A' -d H
   rebasing 2:dc0947a82db8 BOOK-C "C"
   note: not rebasing 2:dc0947a82db8 BOOK-C "C", its destination already has all its changes
-  rebasing 3:b18e25de2cf5 D BOOK-D "D"
-  rebasing 4:03ca77807e91 E BOOK-E "E"
+  rebasing 3:b18e25de2cf5 BOOK-D D "D"
+  rebasing 4:03ca77807e91 BOOK-E E "E"
   rebasing 5:ad6717a6a58e BOOK-F "F"
   note: not rebasing 5:ad6717a6a58e BOOK-F "F", its destination already has all its changes
-  rebasing 6:c58e8bdac1f4 G BOOK-G "G"
+  rebasing 6:c58e8bdac1f4 BOOK-G G "G"
   saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
 
   $ hg log -G -T '{rev} {desc} {bookmarks}'
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -631,7 +631,7 @@ 
   $ hg book foo
   $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
   rebasing 1:6d8d9f24eec3 "a"
-  rebasing 2:1cc73eca5ecc tip foo "b"
+  rebasing 2:1cc73eca5ecc foo tip "b"
   saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
   $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
   @  1: 'collapsed' foo
diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t
--- a/tests/test-rebase-bookmarks.t
+++ b/tests/test-rebase-bookmarks.t
@@ -97,7 +97,7 @@ 
   $ hg book W@diverge
 
   $ hg rebase -s W -d .
-  rebasing 3:41acb9dca9eb tip W "D"
+  rebasing 3:41acb9dca9eb W tip "D"
   saved backup bundle to $TESTTMP/a4/.hg/strip-backup/41acb9dca9eb-b35a6a63-rebase.hg
 
   $ hg bookmarks
@@ -209,7 +209,7 @@ 
   $ hg rebase -r '"bisect"^^::"bisect"^' -r bisect -d Z
   rebasing 5:345c90f326a4 "bisect"
   rebasing 6:f677a2907404 "bisect2"
-  rebasing 7:325c16001345 tip bisect "bisect3"
+  rebasing 7:325c16001345 bisect tip "bisect3"
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/345c90f326a4-b4840586-rebase.hg
 
 Bookmark and working parent get moved even if --keep is set (issue5682)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -274,7 +274,7 @@ 
   
 
   $ hg rebase -d master -r foo
-  rebasing 3:6c0f977a22d8 tip foo "C"
+  rebasing 3:6c0f977a22d8 foo tip "C"
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
@@ -314,7 +314,7 @@ 
   created new head
 
   $ hg rebase -d @ -b foo --tool=internal:fail
-  rebasing 2:070cf4580bb5 tip foo "b2"
+  rebasing 2:070cf4580bb5 foo tip "b2"
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
   [1]
 
diff --git a/tests/test-bookmarks-rebase.t b/tests/test-bookmarks-rebase.t
--- a/tests/test-bookmarks-rebase.t
+++ b/tests/test-bookmarks-rebase.t
@@ -37,7 +37,7 @@ 
 rebase
 
   $ hg rebase -s two -d one
-  rebasing 3:2ae46b1d99a7 tip two "3"
+  rebasing 3:2ae46b1d99a7 two tip "3"
   saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
 
   $ hg log
@@ -77,7 +77,7 @@ 
   created new head
   $ hg bookmark three
   $ hg rebase -s three -d two
-  rebasing 4:dd7c838e8362 tip three "4"
+  rebasing 4:dd7c838e8362 three tip "4"
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
@@ -92,7 +92,7 @@ 
 after aborted rebase, restoring a bookmark that has been removed should not fail
 
   $ hg rebase -s three -d two
-  rebasing 4:dd7c838e8362 tip three "4"
+  rebasing 4:dd7c838e8362 three tip "4"
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1224,13 +1224,11 @@ 
     if not spec:
         spec = (
             b'{separate(" ", '
-            b'label("log.changeset", "{rev}:{node|short}")'
-            b', '
-            b'label("log.tag", tags)'
+            b'label("oneline-summary.changeset", "{rev}:{node|short}")'
             b', '
-            b'label("log.bookmark", bookmarks)'
+            b'join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names % "{label("oneline-summary.{namespace}", name)}", " "))}"), " ")'
             b')} '
-            b'"{label("log.desc", desc|firstline)}"'
+            b'"{label("oneline-summary.desc", desc|firstline)}"'
         )
     text = rendertemplate(ctx, spec)
     return text.split(b'\n')[0]