[PATCH 1 of 2 V2] destutil: make messages at updating to the closed head usual form

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Mar 29 15:05:09 UTC 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1459263572 -32400
#      Tue Mar 29 23:59:32 2016 +0900
# Node ID 9a1bfcecab7ef10171214e1a73c8bd77313178e0
# Parent  c4b727795d6a5770ec523c1965b464baed81097f
destutil: make messages at updating to the closed head usual form

This patch makes messages at updating to the closed head usual form
for Mercurial as below:

    one line description of the problem with no period
    (a suggestion about how to move forward or get more info)

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -397,16 +397,16 @@ def _statusotherbranchheads(ui, repo):
         #  ========= ==========
         otherheads = repo.revs('%ln - parents()', heads)
         if repo['.'].closesbranch():
-            ui.status(_('updated to a closed branch head, '
-                        'because all descendant heads are closed.\n'
-                        'beware of re-opening closed head '
-                        'by subsequent commit here.\n'))
+            ui.status(_('no open descendant heads on branch "%s", '
+                        'updating to a closed head\n') %
+                      (currentbranch))
             if otherheads:
-                ui.status(_('%i other heads for branch "%s"\n') %
-                          (len(otherheads), currentbranch))
+                ui.status(_('(committing will reopen the head, '
+                            'use `hg heads .` to see %i other heads)\n') %
+                          (len(otherheads)))
             else:
-                ui.status(_('all heads for branch "%s" are closed.\n') %
-                          currentbranch)
+                ui.status(_('(committing will reopen branch "%s")\n') %
+                          (currentbranch))
         elif otherheads:
             ui.status(_('%i other heads for branch "%s"\n') %
                       (len(otherheads), currentbranch))
diff --git a/tests/test-convert-mtn.t b/tests/test-convert-mtn.t
--- a/tests/test-convert-mtn.t
+++ b/tests/test-convert-mtn.t
@@ -260,9 +260,8 @@ convert incrementally
   $ cd repo.mtn-hg
   $ hg up -C
   12 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  all heads for branch "com.selenic.test" are closed.
+  no open descendant heads on branch "com.selenic.test", updating to a closed head
+  (committing will reopen branch "com.selenic.test")
   $ glog
   @  14 "largefile" files: large-file
   |
diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -194,9 +194,8 @@ if on the closed branch head:
   $ hg commit --close-branch -m 6
   $ norevtest "on closed branch head" clean 6
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  1 other heads for branch "default"
+  no open descendant heads on branch "default", updating to a closed head
+  (committing will reopen the head, use `hg heads .` to see 1 other heads)
   parent=6
 
 if descendant non-closed branch head exists, and it is only one branch head:
@@ -214,9 +213,8 @@ if all descendant branch heads are close
 
   $ norevtest "all descendant branch heads are closed" clean 3
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  1 other heads for branch "default"
+  no open descendant heads on branch "default", updating to a closed head
+  (committing will reopen the head, use `hg heads .` to see 1 other heads)
   parent=6
 
 Test updating if all branch heads are closed
@@ -230,9 +228,8 @@ if on the closed branch head:
   $ hg commit --close-branch -m 7
   $ norevtest "all heads of branch default are closed" clean 6
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  all heads for branch "default" are closed.
+  no open descendant heads on branch "default", updating to a closed head
+  (committing will reopen branch "default")
   parent=6
 
 if not on the closed branch head:
@@ -242,9 +239,8 @@ if not on the closed branch head:
 
   $ norevtest "all heads of branch default are closed" clean 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  all heads for branch "default" are closed.
+  no open descendant heads on branch "default", updating to a closed head
+  (committing will reopen branch "default")
   parent=7
 
   $ cd ..
@@ -286,9 +282,8 @@ if all branch heads are closed
 
   $ norevtest "all branches are closed" clean null
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  updated to a closed branch head, because all descendant heads are closed.
-  beware of re-opening closed head by subsequent commit here.
-  all heads for branch "foobar" are closed.
+  no open descendant heads on branch "foobar", updating to a closed head
+  (committing will reopen branch "foobar")
   parent=4
 
   $ cd ../b1


More information about the Mercurial-devel mailing list