Rev 3986: ancestor: revspec defaults to parent branch (Daniel Watkins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Feb 9 01:40:54 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3986
revision-id: pqm at pqm.ubuntu.com-20090209014051-5mj66o1vx58glvs9
parent: pqm at pqm.ubuntu.com-20090208133308-rn4wcu897hduyl2d
parent: ian.clatworthy at canonical.com-20090209005501-ihwejj2vzm631sai
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-02-09 01:40:51 +0000
message:
ancestor: revspec defaults to parent branch (Daniel Watkins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
------------------------------------------------------------
revno: 3985.1.1
revision-id: ian.clatworthy at canonical.com-20090209005501-ihwejj2vzm631sai
parent: pqm at pqm.ubuntu.com-20090208133308-rn4wcu897hduyl2d
parent: daniel at daniel-watkins.co.uk-20090208105709-ut76s8m81tjwzjxd
committer: Ian Clatworthy <ian.clatworthy at canonical.com>
branch nick: ianc-integration
timestamp: Mon 2009-02-09 10:55:01 +1000
message:
ancestor: revspec defaults to parent branch (Daniel Watkins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
------------------------------------------------------------
revno: 3984.1.3
revision-id: daniel at daniel-watkins.co.uk-20090208105709-ut76s8m81tjwzjxd
parent: daniel at daniel-watkins.co.uk-20090208105505-kqtrznj2f34jcrt9
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: 198417-ancestor-empty-default
timestamp: Sun 2009-02-08 11:57:09 +0100
message:
Added NEWS entry.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3984.1.2
revision-id: daniel at daniel-watkins.co.uk-20090208105505-kqtrznj2f34jcrt9
parent: daniel at daniel-watkins.co.uk-20090208105215-quyzg0b3rnlappvt
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: 198417-ancestor-empty-default
timestamp: Sun 2009-02-08 11:55:05 +0100
message:
Added fix.
modified:
bzrlib/revisionspec.py revisionspec.py-20050907152633-17567659fd5c0ddb
------------------------------------------------------------
revno: 3984.1.1
revision-id: daniel at daniel-watkins.co.uk-20090208105215-quyzg0b3rnlappvt
parent: pqm at pqm.ubuntu.com-20090205215322-dlhyepy2fid5i7w6
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: 198417-ancestor-empty-default
timestamp: Sun 2009-02-08 11:52:15 +0100
message:
Added test.
modified:
bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
=== modified file 'NEWS'
--- a/NEWS 2009-02-08 13:33:08 +0000
+++ b/NEWS 2009-02-09 00:55:01 +0000
@@ -72,6 +72,10 @@
* Rule-based preferences can now accept multiple patterns for a set of
rules. (Marius Kruger)
+ * The ``ancestor:`` revision spec will now default to referring to the
+ parent of the branch if no other location is given.
+ (Daniel Watkins, #198417)
+
* The debugger started as a result of setting ``$BZR_PDB`` works
around a bug in ``pdb``, http://bugs.python.org/issue4150. The bug
can cause truncated tracebacks in Python versions before 2.6.
=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py 2009-01-28 18:40:34 +0000
+++ b/bzrlib/revisionspec.py 2009-02-08 10:55:05 +0000
@@ -728,6 +728,8 @@
revision_a = revision.ensure_null(branch.last_revision())
if revision_a == revision.NULL_REVISION:
raise errors.NoCommits(branch)
+ if other_location == '':
+ other_location = branch.get_parent()
other_branch = Branch.open(other_location)
other_branch.lock_read()
try:
=== modified file 'bzrlib/tests/test_revisionspec.py'
--- a/bzrlib/tests/test_revisionspec.py 2008-12-04 19:09:52 +0000
+++ b/bzrlib/tests/test_revisionspec.py 2009-02-08 10:52:15 +0000
@@ -553,6 +553,17 @@
def test_as_revision_id(self):
self.assertAsRevisionId('alt_r2', 'ancestor:tree2')
+ def test_default(self):
+ # We don't have a parent to default to
+ self.assertRaises(errors.NotBranchError, self.get_in_history,
+ 'ancestor:')
+
+ # Create a branch with a parent to default to
+ tree3 = self.tree.bzrdir.sprout('tree3').open_workingtree()
+ tree3.commit('foo', rev_id='r3')
+ self.tree = tree3
+ self.assertInHistoryIs(2, 'r2', 'ancestor:')
+
class TestRevisionSpec_branch(TestRevisionSpec):
More information about the bazaar-commits
mailing list