Rev 3630: Change 'bzr uncommit' to display the revision ids and log them. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/uncommit_ids

John Arbash Meinel john at arbash-meinel.com
Thu Aug 14 17:05:03 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/uncommit_ids

------------------------------------------------------------
revno: 3630
revision-id: john at arbash-meinel.com-20080814160452-9tp32zqblv7iw57x
parent: pqm at pqm.ubuntu.com-20080814074117-x0zvzzv7y6mok8pz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: uncommit_ids
timestamp: Thu 2008-08-14 11:04:52 -0500
message:
  Change 'bzr uncommit' to display the revision ids and log them.
  This makes it easier to recover from uncommit if you change your mind.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-08-14 06:46:29 +0000
+++ b/NEWS	2008-08-14 16:04:52 +0000
@@ -9,6 +9,11 @@
 
   CHANGES:
 
+    * ``bzr uncommit`` shows the revision ids for the revisions you will
+      be removing. This allows you to easily change your mind and
+      ``bzr pull`` your branch back to what it was.
+      (John Arbash Meinel)
+
   IMPROVEMENTS:
 
   BUG FIXES:

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-08-11 03:39:25 +0000
+++ b/bzrlib/builtins.py	2008-08-14 16:04:52 +0000
@@ -3740,7 +3740,8 @@
 
         lf = log_formatter('short',
                            to_file=self.outf,
-                           show_timezone='original')
+                           show_timezone='original',
+                           show_ids=True)
 
         show_log(b,
                  lf,
@@ -3761,6 +3762,8 @@
                     print 'Canceled'
                     return 0
 
+        mutter('Uncommitting from {%s} to {%s}',
+               last_rev_id, rev_id)
         uncommit(b, tree=tree, dry_run=dry_run, verbose=verbose,
                  revno=revno, local=local)
 

=== modified file 'bzrlib/tests/blackbox/test_uncommit.py'
--- a/bzrlib/tests/blackbox/test_uncommit.py	2008-06-04 17:52:58 +0000
+++ b/bzrlib/tests/blackbox/test_uncommit.py	2008-08-14 16:04:52 +0000
@@ -32,7 +32,7 @@
         wt.add(['a', 'b', 'c'])
         wt.commit('initial commit', rev_id='a1')
 
-        open('tree/a', 'wb').write('new contents of a\n')
+        self.build_tree_contents([('tree/a', 'new contents of a\n')])
         wt.commit('second commit', rev_id='a2')
 
         return wt
@@ -213,6 +213,13 @@
 
         self.assertEqual(['a2', 'b3', 'c3'], wt.get_parent_ids())
 
+    def test_uncommit_shows_log_with_revision_id(self):
+        wt = self.create_simple_tree()
+
+        out, err = self.run_bzr('uncommit --force', working_dir='tree')
+        self.assertContainsRe(out, r'second commit')
+        self.assertContainsRe(out, r'revision-id:a2')
+
     def test_uncommit_octopus_merge(self):
         # Check that uncommit keeps the pending merges in the same order
         # though it will also filter out ones in the ancestry
@@ -223,7 +230,7 @@
 
         tree2.commit('unchanged', rev_id='b3')
         tree3.commit('unchanged', rev_id='c3')
-        
+
         wt.merge_from_branch(tree2.branch)
         wt.merge_from_branch(tree3.branch)
         wt.commit('merge b3, c3', rev_id='a3')



More information about the bazaar-commits mailing list