Rev 2515: Various fixes for revision-info (Metthew Fuller) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jun 7 01:21:27 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2515
revision-id: pqm at pqm.ubuntu.com-20070607002124-64z9d0o6x0e9iwbl
parent: pqm at pqm.ubuntu.com-20070606201738-u5pu5rxhdoyehimv
parent: aaron.bentley at utoronto.ca-20070606235207-3pu0d9xsweqlxt55
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-06-07 01:21:24 +0100
message:
Various fixes for revision-info (Metthew Fuller)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_revision_info.py test_revision_info.py-20050917162600-21dab3877aa348d7
------------------------------------------------------------
revno: 2514.1.1
merged: aaron.bentley at utoronto.ca-20070606235207-3pu0d9xsweqlxt55
parent: pqm at pqm.ubuntu.com-20070606201738-u5pu5rxhdoyehimv
parent: fullermd at over-yonder.net-20070606113402-gyuk793gumqrfjrm
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: bzr.ab.integration
timestamp: Wed 2007-06-06 19:52:07 -0400
message:
Various fixes for revision-info (Metthew Fuller)
------------------------------------------------------------
revno: 2512.2.4
merged: fullermd at over-yonder.net-20070606113402-gyuk793gumqrfjrm
parent: fullermd at over-yonder.net-20070606105410-b7gb18p3qw8vrzk8
committer: Matthew Fuller <fullermd at over-yonder.net>
branch nick: revision-info
timestamp: Wed 2007-06-06 06:34:02 -0500
message:
Rewrite revision-info blackbox tests to test:
- Support for dotted revnos
- Defaulting to head of branch if no rev given
- Functioning without working tree
------------------------------------------------------------
revno: 2512.2.3
merged: fullermd at over-yonder.net-20070606105410-b7gb18p3qw8vrzk8
parent: fullermd at over-yonder.net-20070606104510-75dot0o1k4n396ju
committer: Matthew Fuller <fullermd at over-yonder.net>
branch nick: revision-info
timestamp: Wed 2007-06-06 05:54:10 -0500
message:
Default revision-info to the head of the branch when no revision is
given.
------------------------------------------------------------
revno: 2512.2.2
merged: fullermd at over-yonder.net-20070606104510-75dot0o1k4n396ju
parent: fullermd at over-yonder.net-20070606102332-i7n2yh30rh8noob7
committer: Matthew Fuller <fullermd at over-yonder.net>
branch nick: revision-info
timestamp: Wed 2007-06-06 05:45:10 -0500
message:
Update revision-info to show dotted revnos.
------------------------------------------------------------
revno: 2512.2.1
merged: fullermd at over-yonder.net-20070606102332-i7n2yh30rh8noob7
parent: pqm at pqm.ubuntu.com-20070606083714-rt2za45t9gt5nqqh
committer: Matthew Fuller <fullermd at over-yonder.net>
branch nick: revision-info
timestamp: Wed 2007-06-06 05:23:32 -0500
message:
revision-info has no call to need a WorkingTree, so don't demand one.
=== modified file 'NEWS'
--- a/NEWS 2007-06-06 06:17:45 +0000
+++ b/NEWS 2007-06-06 23:52:07 +0000
@@ -78,6 +78,9 @@
* Merge no longer fails when a file is renamed in one tree and deleted
in the other. (Aaron Bentley, #110279)
+ * ``revision-info`` now accepts dotted revnos, doesn't require a tree,
+ and defaults to the last revision (Matthew Fuller, #90048)
+
bzr 0.16 2007-05-07
BUGFIXES:
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-05-25 04:00:47 +0000
+++ b/bzrlib/builtins.py 2007-06-06 10:54:10 +0000
@@ -45,6 +45,7 @@
osutils,
registry,
repository,
+ revisionspec,
symbol_versioning,
transport,
tree as _mod_tree,
@@ -304,15 +305,18 @@
if revision_info_list is not None:
for rev in revision_info_list:
revs.append(RevisionSpec.from_string(rev))
+
+ b = Branch.open_containing(u'.')[0]
+
if len(revs) == 0:
- raise errors.BzrCommandError('You must supply a revision identifier')
-
- b = WorkingTree.open_containing(u'.')[0].branch
+ revs.append(RevisionSpec.from_string('-1'))
for rev in revs:
revinfo = rev.in_history(b)
if revinfo.revno is None:
- print ' %s' % revinfo.rev_id
+ dotted_map = b.get_revision_id_to_revno_map()
+ revno = '.'.join(str(i) for i in dotted_map[revinfo.rev_id])
+ print '%s %s' % (revno, revinfo.rev_id)
else:
print '%4d %s' % (revinfo.revno, revinfo.rev_id)
=== modified file 'bzrlib/tests/blackbox/test_revision_info.py'
--- a/bzrlib/tests/blackbox/test_revision_info.py 2007-04-10 21:05:17 +0000
+++ b/bzrlib/tests/blackbox/test_revision_info.py 2007-06-06 11:34:02 +0000
@@ -35,40 +35,51 @@
"""Test that 'bzr revision-info' reports the correct thing."""
wt = self.make_branch_and_tree('.')
+ # Make history with a non-mainline rev
wt.commit('Commit one', rev_id='a at r-0-1')
- wt.commit('Commit two', rev_id='a at r-0-2')
- wt.commit('Commit three', rev_id='a at r-0-3')
-
- # Make sure revision-info without any arguments throws an exception
- self.check_error('bzr: ERROR: '
- 'You must supply a revision identifier\n',
- 'revision-info')
-
+ wt.commit('Commit two', rev_id='a at r-0-1.1.1')
+ wt.set_parent_ids(['a at r-0-1', 'a at r-0-1.1.1'])
+ wt.branch.set_last_revision_info(1, 'a at r-0-1')
+ wt.commit('Commit three', rev_id='a at r-0-2')
+
+ # This is expected to work even if the working tree is removed
+ wt.bzrdir.destroy_workingtree()
+
+ # Expected return values
values = {
- 1:' 1 a at r-0-1\n',
- 2:' 2 a at r-0-2\n',
- 3:' 3 a at r-0-3\n'
+ '1' : ' 1 a at r-0-1\n',
+ '1.1.1': '1.1.1 a at r-0-1.1.1\n',
+ '2' : ' 2 a at r-0-2\n'
}
+ # Make sure with no arg it defaults to the head
+ self.check_output(values['2'], 'revision-info')
+
# Check the results of just specifying a numeric revision
- self.check_output(values[1], 'revision-info', '1')
- self.check_output(values[2], 'revision-info', '2')
- self.check_output(values[3], 'revision-info', '3')
- self.check_output(values[1]+values[2], 'revision-info', '1', '2')
- self.check_output(values[1]+values[2]+values[3], 'revision-info', '1', '2', '3')
- self.check_output(values[2]+values[1], 'revision-info', '2', '1')
+ self.check_output(values['1'], 'revision-info', '1')
+ self.check_output(values['1.1.1'], 'revision-info', '1.1.1')
+ self.check_output(values['2'], 'revision-info', '2')
+ self.check_output(values['1']+values['2'], 'revision-info', '1', '2')
+ self.check_output(values['1']+values['1.1.1']+values['2'],
+ 'revision-info', '1', '1.1.1', '2')
+ self.check_output(values['2']+values['1'], 'revision-info', '2', '1')
# Check as above, only using the '--revision' syntax
- self.check_output(' 1 a at r-0-1\n', 'revision-info', '-r', '1')
- self.check_output(' 2 a at r-0-2\n', 'revision-info', '--revision', '2')
- self.check_output(' 3 a at r-0-3\n', 'revision-info', '-r', '3')
- self.check_output(' 1 a at r-0-1\n 2 a at r-0-2\n', 'revision-info', '-r', '1..2')
- self.check_output(' 1 a at r-0-1\n 2 a at r-0-2\n 3 a at r-0-3\n'
- , 'revision-info', '-r', '1..2..3')
- self.check_output(' 2 a at r-0-2\n 1 a at r-0-1\n', 'revision-info', '-r', '2..1')
+ self.check_output(values['1'], 'revision-info', '-r', '1')
+ self.check_output(values['1.1.1'], 'revision-info', '--revision',
+ '1.1.1')
+ self.check_output(values['2'], 'revision-info', '-r', '2')
+ self.check_output(values['1']+values['2'], 'revision-info',
+ '-r', '1..2')
+ self.check_output(values['1']+values['1.1.1']+values['2'],
+ 'revision-info', '-r', '1..1.1.1..2')
+ self.check_output(values['2']+values['1'], 'revision-info',
+ '-r', '2..1')
# Now try some more advanced revision specifications
- self.check_output(' 1 a at r-0-1\n', 'revision-info', '-r', 'revid:a at r-0-1')
- self.check_output(' 2 a at r-0-2\n', 'revision-info', '--revision', 'revid:a at r-0-2')
+ self.check_output(values['1'], 'revision-info', '-r',
+ 'revid:a at r-0-1')
+ self.check_output(values['1.1.1'], 'revision-info', '--revision',
+ 'revid:a at r-0-1.1.1')
More information about the bazaar-commits
mailing list