Rev 5140: (igc for parthm) update -r dotted-revno support in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Apr 8 08:32:49 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5140 [merge]
revision-id: pqm at pqm.ubuntu.com-20100408073248-aj7k8qkvbv4nzlxd
parent: pqm at pqm.ubuntu.com-20100408061741-m7vl6z97vu33riv7
parent: ian.clatworthy at canonical.com-20100408060544-dshzbmikgyv7ccyj
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-04-08 08:32:48 +0100
message:
(igc for parthm) update -r dotted-revno support
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_update.py test_update.py-20060212125639-c4dad1a5c56d5919
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS 2010-04-08 04:34:03 +0000
+++ b/NEWS 2010-04-08 07:32:48 +0000
@@ -236,6 +236,10 @@
* Tolerate patches with leading noise in ``bzr-handle-patch``.
(Toshio Kuratomi, Martin Pool, #502076)
+* ``update -r`` now supports updating to revisions that are not on
+ mainline (i.e. it supports dotted revisions).
+ (Parth Malwankar, #517800)
+
* ``.bazaar``, ``.bazaar/bazaar.conf`` and ``.bzr.log`` inherit user and
group ownership from the containing directory. This allow bzr to work
better with sudo.
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2010-04-07 00:50:56 +0000
+++ b/bzrlib/builtins.py 2010-04-08 06:05:44 +0000
@@ -1448,9 +1448,9 @@
else:
revision_id = branch.last_revision()
if revision_id == _mod_revision.ensure_null(tree.last_revision()):
- revno = branch.revision_id_to_revno(revision_id)
- note("Tree is up to date at revision %d of branch %s" %
- (revno, branch_location))
+ revno = branch.revision_id_to_dotted_revno(revision_id)
+ note("Tree is up to date at revision %s of branch %s" %
+ ('.'.join(map(str, revno)), branch_location))
return 0
view_info = _get_view_info_for_change_reporter(tree)
change_reporter = delta._ChangeReporter(
@@ -1468,10 +1468,10 @@
"bzr update --revision only works"
" for a revision in the branch history"
% (e.revision))
- revno = tree.branch.revision_id_to_revno(
+ revno = tree.branch.revision_id_to_dotted_revno(
_mod_revision.ensure_null(tree.last_revision()))
- note('Updated to revision %d of branch %s' %
- (revno, branch_location))
+ note('Updated to revision %s of branch %s' %
+ ('.'.join(map(str, revno)), branch_location))
if tree.get_parent_ids()[1:] != existing_pending_merges:
note('Your local commits will now show as pending merges with '
"'bzr status', and can be committed with 'bzr commit'.")
=== modified file 'bzrlib/tests/blackbox/test_update.py'
--- a/bzrlib/tests/blackbox/test_update.py 2010-03-11 11:07:32 +0000
+++ b/bzrlib/tests/blackbox/test_update.py 2010-03-31 18:11:51 +0000
@@ -263,28 +263,36 @@
self.assertEquals(['m1'], master.get_parent_ids())
def test_update_dash_r_outside_history(self):
+ """Ensure that we can update -r to dotted revisions.
+ """
master = self.make_branch_and_tree('master')
self.build_tree(['master/file1'])
master.add(['file1'])
master.commit('one', rev_id='m1')
- # Create a second branch, with an extra commit
+ # Create a second branch, with extra commits
other = master.bzrdir.sprout('other').open_workingtree()
- self.build_tree(['other/file2'])
+ self.build_tree(['other/file2', 'other/file3'])
other.add(['file2'])
other.commit('other2', rev_id='o2')
+ other.add(['file3'])
+ other.commit('other3', rev_id='o3')
os.chdir('master')
self.run_bzr('merge ../other')
master.commit('merge', rev_id='merge')
- out, err = self.run_bzr('update -r revid:o2',
- retcode=3)
- self.assertEqual('', out)
- self.assertEqual('bzr: ERROR: branch has no revision o2\n'
- 'bzr update --revision only works'
- ' for a revision in the branch history\n',
- err)
+ # Switch to o2. file3 was added only in o3 and should be deleted.
+ out, err = self.run_bzr('update -r revid:o2')
+ self.assertContainsRe(err, '-D\s+file3')
+ self.assertContainsRe(err, 'All changes applied successfully\.')
+ self.assertContainsRe(err, 'Updated to revision 1.1.1 of branch .*')
+
+ # Switch back to latest
+ out, err = self.run_bzr('update')
+ self.assertContainsRe(err, '\+N\s+file3')
+ self.assertContainsRe(err, 'All changes applied successfully\.')
+ self.assertContainsRe(err, 'Updated to revision 2 of branch .*')
def test_update_dash_r_in_master(self):
# Test that 'bzr update' works correctly when you have
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2010-04-01 12:53:53 +0000
+++ b/bzrlib/workingtree.py 2010-04-08 06:05:44 +0000
@@ -2258,9 +2258,6 @@
last_rev = _mod_revision.NULL_REVISION
if revision is None:
revision = self.branch.last_revision()
- else:
- if revision not in self.branch.revision_history():
- raise errors.NoSuchRevision(self.branch, revision)
old_tip = old_tip or _mod_revision.NULL_REVISION
More information about the bazaar-commits
mailing list