Rev 4000: Improve shelf documentation & fix backtrace (Daniel Watkins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Feb 11 01:12:44 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4000
revision-id: pqm at pqm.ubuntu.com-20090211011240-gv0zdxmwomt3ndtn
parent: pqm at pqm.ubuntu.com-20090211000730-hzn2dne4230w8vyv
parent: ian.clatworthy at canonical.com-20090211002957-m3f364g9ovnwqm6h
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-02-11 01:12:40 +0000
message:
Improve shelf documentation & fix backtrace (Daniel Watkins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/shelf_ui.py shelver.py-20081005210102-33worgzwrtdw0yrm-1
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_shelf_ui.py test_shelf_ui.py-20081027155203-wtcuazg85wp9u4fv-1
------------------------------------------------------------
revno: 3999.1.1
revision-id: ian.clatworthy at canonical.com-20090211002957-m3f364g9ovnwqm6h
parent: pqm at pqm.ubuntu.com-20090211000730-hzn2dne4230w8vyv
parent: daniel at daniel-watkins.co.uk-20090210000903-2ac78kfpjlzpja8b
committer: Ian Clatworthy <ian.clatworthy at canonical.com>
branch nick: ianc-integration
timestamp: Wed 2009-02-11 10:29:57 +1000
message:
Improve shelf documentation & fix backtrace (Daniel Watkins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/shelf_ui.py shelver.py-20081005210102-33worgzwrtdw0yrm-1
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
bzrlib/tests/test_shelf_ui.py test_shelf_ui.py-20081027155203-wtcuazg85wp9u4fv-1
------------------------------------------------------------
revno: 3990.2.7
revision-id: daniel at daniel-watkins.co.uk-20090210000903-2ac78kfpjlzpja8b
parent: daniel at daniel-watkins.co.uk-20090209234435-n2owqj4bgjkn4omc
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Tue 2009-02-10 00:09:03 +0000
message:
Added NEWS entries.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3990.2.6
revision-id: daniel at daniel-watkins.co.uk-20090209234435-n2owqj4bgjkn4omc
parent: daniel at daniel-watkins.co.uk-20090209233654-rk9hduglup3d12yp
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:44:35 +0000
message:
Improved shelve documentation, as per #327421.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
------------------------------------------------------------
revno: 3990.2.5
revision-id: daniel at daniel-watkins.co.uk-20090209233654-rk9hduglup3d12yp
parent: daniel at daniel-watkins.co.uk-20090209233446-k6tovw3vw3a47u8v
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:36:54 +0000
message:
Improve unshelve documentation, as per #327425.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
------------------------------------------------------------
revno: 3990.2.4
revision-id: daniel at daniel-watkins.co.uk-20090209233446-k6tovw3vw3a47u8v
parent: daniel at daniel-watkins.co.uk-20090209233421-xv1oyk5pzgqj931u
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:34:46 +0000
message:
Don't stack trace with an invalid shelf id.
modified:
bzrlib/shelf_ui.py shelver.py-20081005210102-33worgzwrtdw0yrm-1
------------------------------------------------------------
revno: 3990.2.3
revision-id: daniel at daniel-watkins.co.uk-20090209233421-xv1oyk5pzgqj931u
parent: daniel at daniel-watkins.co.uk-20090209232658-npfcqo2ryr5tx414
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:34:21 +0000
message:
Made error message slightly more friendly.
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
------------------------------------------------------------
revno: 3990.2.2
revision-id: daniel at daniel-watkins.co.uk-20090209232658-npfcqo2ryr5tx414
parent: daniel at daniel-watkins.co.uk-20090209232113-ebuwr43alqoldp5i
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:26:58 +0000
message:
Added InvalidShelfId error and accompanying test.
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
------------------------------------------------------------
revno: 3990.2.1
revision-id: daniel at daniel-watkins.co.uk-20090209232113-ebuwr43alqoldp5i
parent: pqm at pqm.ubuntu.com-20090209210810-cq9lgqy519b7wfyi
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: shelf
timestamp: Mon 2009-02-09 23:21:13 +0000
message:
Added test for unshelve being passed an invalid shelf_id.
modified:
bzrlib/tests/test_shelf_ui.py test_shelf_ui.py-20081027155203-wtcuazg85wp9u4fv-1
=== modified file 'NEWS'
--- a/NEWS 2009-02-10 23:17:20 +0000
+++ b/NEWS 2009-02-11 00:29:57 +0000
@@ -25,8 +25,14 @@
BUG FIXES:
+ * ``bzr unshelve`` gives a more palatable error if passed a non-integer
+ shelf id. (Daniel Watkins)
+
DOCUMENTATION:
+ * The documentation for ``shelve`` and ``unshelve`` has been clarified.
+ (Daniel Watkins, #327421, #327425)
+
API CHANGES:
INTERNALS:
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-02-10 05:47:45 +0000
+++ b/bzrlib/builtins.py 2009-02-11 00:29:57 +0000
@@ -4954,7 +4954,9 @@
Shelve allows you to temporarily put changes you've made "on the shelf",
ie. out of the way, until a later time when you can bring them back from
- the shelf with the 'unshelve' command.
+ the shelf with the 'unshelve' command. The changes are stored alongside
+ your working tree, and so they aren't propagated along with your branch nor
+ will they survive its deletion.
If shelve --list is specified, previously-shelved changes are listed.
@@ -5022,8 +5024,8 @@
"""Restore shelved changes.
By default, the most recently shelved changes are restored. However if you
- specify a patch by name those changes will be restored instead. This
- works best when the changes don't depend on each other.
+ specify a shelf by id those changes will be restored instead. This works
+ best when the changes don't depend on each other.
"""
takes_args = ['shelf_id?']
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2009-02-10 05:47:45 +0000
+++ b/bzrlib/errors.py 2009-02-11 00:29:57 +0000
@@ -2934,6 +2934,14 @@
BzrError.__init__(self, shelf_id=shelf_id)
+class InvalidShelfId(BzrError):
+
+ _fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
+
+ def __init__(self, invalid_id):
+ BzrError.__init__(self, invalid_id=invalid_id)
+
+
class UserAbort(BzrError):
_fmt = 'The user aborted the operation.'
=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py 2008-12-12 06:09:44 +0000
+++ b/bzrlib/shelf_ui.py 2009-02-09 23:34:46 +0000
@@ -223,7 +223,10 @@
tree, path = workingtree.WorkingTree.open_containing(directory)
manager = tree.get_shelf_manager()
if shelf_id is not None:
- shelf_id = int(shelf_id)
+ try:
+ shelf_id = int(shelf_id)
+ except ValueError:
+ raise errors.InvalidShelfId(shelf_id)
else:
shelf_id = manager.last_shelf()
if shelf_id is None:
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2009-02-10 03:12:50 +0000
+++ b/bzrlib/tests/test_errors.py 2009-02-11 00:29:57 +0000
@@ -577,6 +577,12 @@
self.assertEqual(str(err), "Branching 'bar'(foo) must create a"
" working tree.")
+ def test_invalid_shelf_id(self):
+ invalid_id = "foo"
+ err = errors.InvalidShelfId(invalid_id)
+ self.assertEqual('"foo" is not a valid shelf id, '
+ 'try a number instead.', str(err))
+
class PassThroughError(errors.BzrError):
=== modified file 'bzrlib/tests/test_shelf_ui.py'
--- a/bzrlib/tests/test_shelf_ui.py 2008-11-15 20:37:36 +0000
+++ b/bzrlib/tests/test_shelf_ui.py 2009-02-11 00:29:57 +0000
@@ -236,3 +236,15 @@
action='delete-only')
unshelver.run()
self.assertIs(None, manager.last_shelf())
+
+ def test_unshelve_args_invalid_shelf_id(self):
+ tree = self.make_branch_and_tree('tree')
+ manager = tree.get_shelf_manager()
+ shelf_file = manager.new_shelf()[1]
+ try:
+ shelf_file.write('garbage')
+ finally:
+ shelf_file.close()
+ self.assertRaises(errors.InvalidShelfId,
+ shelf_ui.Unshelver.from_args, directory='tree',
+ action='delete-only', shelf_id='foo')
More information about the bazaar-commits
mailing list