Rev 5624: (jelmer) Support short option '-F' as alternative for 'bzr diff --format'. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 19 20:23:00 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5624 [merge]
revision-id: pqm at pqm.ubuntu.com-20110119202257-1fi3v53uhzsvacci
parent: pqm at pqm.ubuntu.com-20110119191718-5x6p1ymzxpubeiuq
parent: jelmer at samba.org-20110119184411-owiw85qqlerjkvm5
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-19 20:22:57 +0000
message:
(jelmer) Support short option '-F' as alternative for 'bzr diff --format'.
(Jelmer Vernooij)
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/option.py option.py-20051014052914-661fb36e76e7362f
bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
bzrlib/tests/test_options.py testoptions.py-20051014093702-96457cfc86319a8f
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2011-01-19 17:43:43 +0000
+++ b/bzrlib/builtins.py 2011-01-19 18:40:15 +0000
@@ -1962,9 +1962,10 @@
type=unicode,
),
RegistryOption('format',
+ short_name='F',
help='Diff format to use.',
lazy_registry=('bzrlib.diff', 'format_registry'),
- value_switches=False, title='Diff format'),
+ title='Diff format'),
]
aliases = ['di', 'dif']
encoding_type = 'exact'
=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py 2010-05-23 18:57:38 +0000
+++ b/bzrlib/option.py 2011-01-14 05:14:04 +0000
@@ -312,7 +312,7 @@
def __init__(self, name, help, registry=None, converter=None,
value_switches=False, title=None, enum_switch=True,
- lazy_registry=None):
+ lazy_registry=None, short_name=None):
"""
Constructor.
@@ -329,7 +329,7 @@
:param lazy_registry: A tuple of (module name, attribute name) for a
registry to be lazily loaded.
"""
- Option.__init__(self, name, help, type=self.convert)
+ Option.__init__(self, name, help, type=self.convert, short_name=short_name)
self._registry = registry
if registry is None:
if lazy_registry is None:
=== modified file 'bzrlib/tests/blackbox/test_diff.py'
--- a/bzrlib/tests/blackbox/test_diff.py 2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/blackbox/test_diff.py 2011-01-19 18:44:11 +0000
@@ -323,6 +323,9 @@
self.build_tree_contents([('hello', 'hello world!\n')])
output = self.run_bzr('diff --format=boo', retcode=1)
self.assertTrue("BOO!" in output[0])
+ output = self.run_bzr('diff -Fboo', retcode=1)
+ self.assertTrue("BOO!" in output[0])
+
class TestCheckoutDiff(TestDiff):
=== modified file 'bzrlib/tests/test_options.py'
--- a/bzrlib/tests/test_options.py 2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/test_options.py 2011-01-19 18:40:15 +0000
@@ -396,6 +396,14 @@
self.assertTrue(format.is_hidden('hidden'))
self.assertFalse(format.is_hidden('visible'))
+ def test_short_name(self):
+ registry = controldir.ControlDirFormatRegistry()
+ opt = option.RegistryOption('format', help='', registry=registry)
+ self.assertEquals(None, opt.short_name())
+ opt = option.RegistryOption('format', short_name='F', help='',
+ registry=registry)
+ self.assertEquals('F', opt.short_name())
+
def test_option_custom_help(self):
the_opt = option.Option.OPTIONS['help']
orig_help = the_opt.help[:]
More information about the bazaar-commits
mailing list