[PATCH 2 of 2] rollback: tell the user their previous commit message was saved

Greg Ward greg-hg at gerg.ca
Sat Nov 21 16:11:34 CST 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1258840694 18000
# Node ID 70532501cffb1b5869f1f97c4bac10262b98dfb4
# Parent  14424eaaae621395167ace250d6e48488ff75519
rollback: tell the user their previous commit message was saved
(issue1635)

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -596,7 +596,12 @@
             wlock = self.wlock()
             lock = self.lock()
             if os.path.exists(self.sjoin("undo")):
-                self.ui.status(_("rolling back last transaction\n"))
+                status = _("rolling back last transaction\n")
+                if os.path.exists(self.join("message")):
+                    status = _(
+                        "rolling back last transaction "
+                        "(last commit message saved in .hg/message)\n")
+                self.ui.status(status)
                 transaction.rollback(self.sopener, self.sjoin("undo"), self.ui.warn)
                 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
                 try:
diff --git a/tests/test-backout.out b/tests/test-backout.out
--- a/tests/test-backout.out
+++ b/tests/test-backout.out
@@ -62,7 +62,7 @@
 # backout with valid parent should be ok
 removing d
 changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 removing c
 changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
diff --git a/tests/test-diff-color.out b/tests/test-diff-color.out
--- a/tests/test-diff-color.out
+++ b/tests/test-diff-color.out
@@ -41,7 +41,7 @@
  a
  c
 record this change to 'a'? [Ynsfdaq?] 
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 % qrecord
 diff --git a/a b/a
 old mode 100644
diff --git a/tests/test-import.out b/tests/test-import.out
--- a/tests/test-import.out
+++ b/tests/test-import.out
@@ -176,7 +176,7 @@
 parent: 0
 applying ../patch1
 applying ../patch2
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 parent: 1
 % hg import in a subdirectory
 requesting all changes
diff --git a/tests/test-keyword.out b/tests/test-keyword.out
--- a/tests/test-keyword.out
+++ b/tests/test-keyword.out
@@ -196,7 +196,7 @@
 +do not process $Id:
 +xxx $
 % rollback
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 % status
 A c
 % update -C
@@ -264,7 +264,7 @@
 % status
 ? c
 % rollback
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 % status
 R a
 ? c
@@ -306,7 +306,7 @@
 ignore $Id$
 
 % rollback
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 % clean update
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % kwexpand/kwshrink on selected files
diff --git a/tests/test-newbranch.out b/tests/test-newbranch.out
--- a/tests/test-newbranch.out
+++ b/tests/test-newbranch.out
@@ -62,7 +62,7 @@
 default
 bar
 % test for invalid branch cache
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 changeset:   4:4909a3732169
 branch:      foo
 tag:         tip
diff --git a/tests/test-push-http.out b/tests/test-push-http.out
--- a/tests/test-push-http.out
+++ b/tests/test-push-http.out
@@ -25,7 +25,7 @@
 added 1 changesets with 1 changes to 1 files
 % serve errors
 changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http 
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 % expect authorization error: all users denied
 abort: authorization failed
 pushing to http://localhost/
diff --git a/tests/test-rename-after-merge.out b/tests/test-rename-after-merge.out
--- a/tests/test-rename-after-merge.out
+++ b/tests/test-rename-after-merge.out
@@ -34,7 +34,7 @@
 (branch merge, don't forget to commit)
 % commit issue 1476
 copies:      c2 (c1)
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
 % merge heads again
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-rollback.out b/tests/test-rollback.out
--- a/tests/test-rollback.out
+++ b/tests/test-rollback.out
@@ -9,7 +9,7 @@
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     test
 
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
@@ -18,14 +18,14 @@
 A a
 % Test issue 902
 marked working directory as branch test
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 default
 % Test issue 1635 (commit message saved)
 .hg/message:
 test2
 % Test rollback of hg before issue 902 was fixed
 marked working directory as branch test
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 Named branch could not be reset, current branch still is: test
 test
 .hg/message:
diff --git a/tests/test-tags.out b/tests/test-tags.out
--- a/tests/test-tags.out
+++ b/tests/test-tags.out
@@ -111,7 +111,7 @@
 summary:     Removed tag bar
 
 % rollback undoes tag operation
-rolling back last transaction
+rolling back last transaction (last commit message saved in .hg/message)
 tip                                4:0c192d7d5e6b
 bar                                1:78391a272241
 tip                                4:0c192d7d5e6b


More information about the Mercurial-devel mailing list