Rev 5805: (jelmer) Raise InvalidRevisionId when None is specified to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Apr 19 21:34:37 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5805 [merge]
revision-id: pqm at pqm.ubuntu.com-20110419213424-01noh6bpf72g1cn2
parent: pqm at pqm.ubuntu.com-20110419141243-f3jl3dextzl70jdf
parent: jelmer at samba.org-20110419135632-7r3ag46vdsfw00td
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-04-19 21:34:24 +0000
message:
(jelmer) Raise InvalidRevisionId when None is specified to
Branch.set_last_revision_info(). (Jelmer Vernooij)
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/tests/per_branch/test_revision_history.py test_revision_histor-20070326062311-v7co92liyuchb80w-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2011-04-12 00:44:43 +0000
+++ b/bzrlib/branch.py 2011-04-19 13:56:32 +0000
@@ -2577,7 +2577,8 @@
configured to check constraints on history, in which case this may not
be permitted.
"""
- revision_id = _mod_revision.ensure_null(revision_id)
+ if not revision_id or not isinstance(revision_id, basestring):
+ raise errors.InvalidRevisionId(revision_id=revision_id, branch=self)
# this old format stores the full history, but this api doesn't
# provide it, so we must generate, and might as well check it's
# correct
@@ -2813,7 +2814,8 @@
@needs_write_lock
def set_last_revision_info(self, revno, revision_id):
- revision_id = _mod_revision.ensure_null(revision_id)
+ if not revision_id or not isinstance(revision_id, basestring):
+ raise errors.InvalidRevisionId(revision_id=revision_id, branch=self)
old_revno, old_revid = self.last_revision_info()
if self._get_append_revisions_only():
self._check_history_violation(revision_id)
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2011-04-11 00:18:12 +0000
+++ b/bzrlib/remote.py 2011-04-19 13:56:32 +0000
@@ -3003,7 +3003,8 @@
# XXX: These should be returned by the set_last_revision_info verb
old_revno, old_revid = self.last_revision_info()
self._run_pre_change_branch_tip_hooks(revno, revision_id)
- revision_id = _mod_revision.ensure_null(revision_id)
+ if not revision_id or not isinstance(revision_id, basestring):
+ raise errors.InvalidRevisionId(revision_id=revision_id, branch=self)
try:
response = self._call('Branch.set_last_revision_info',
self._remote_path(), self._lock_token, self._repo_lock_token,
=== modified file 'bzrlib/tests/per_branch/test_revision_history.py'
--- a/bzrlib/tests/per_branch/test_revision_history.py 2010-02-10 17:52:08 +0000
+++ b/bzrlib/tests/per_branch/test_revision_history.py 2011-04-19 13:56:32 +0000
@@ -147,17 +147,14 @@
a_branch.unlock()
def test_set_last_revision_info_none(self):
- """Passing None to revision_info to None sets it to NULL_REVISION."""
+ """Passing None to set_last_revision_info raises an exception."""
a_branch = self.get_branch()
# Lock the branch, set the last revision info, then call
# last_revision_info.
a_branch.lock_write()
self.addCleanup(a_branch.unlock)
- self.callDeprecated(['NULL_REVISION should be used for the null'
- ' revision instead of None, as of bzr 0.91.'],
+ self.assertRaises(errors.InvalidRevisionId,
a_branch.set_last_revision_info, 0, None)
- self.assertEqual((0, _mod_revision.NULL_REVISION),
- a_branch.last_revision_info())
def test_set_last_revision_info_uncaches_revision_history_for_format6(self):
"""On format 6 branches, set_last_revision_info invalidates the revision
More information about the bazaar-commits
mailing list