Mercurial > hgsubversion
comparison hgsubversion/__init__.py @ 1512:6d0fe7ce9898
commands: fix command option registering
A recent patch introduced svnopts as a way of sharing the svn command options
between the old and the new way of registering a command. It turns out 'svnopts'
was already used further up in the module to define the flags that should be
added to *all* Mercurial commands. So our definition of it here cause us to add
all of these options to all Mercurial commands.
This was caught because it changes --rev to be '' instead of [], which breaks a
number of assumptions in the other commands.
Given that none of the subversion tests are command line tests, I'm not sure how
to test this. It was caught in other extensions tests.
(grafted from 3b1334407783a4379fd515e2ed9acc61e3f175ff)
(grafted from 6db63ead5556f2bf72e423ca8c6df08ea3a5b009)
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 24 May 2017 15:07:00 -0700 |
parents | 332e803044e5 |
children | fb0652923435 |
comparison
equal
deleted
inserted
replaced
1511:cb29f4bffcc7 | 1512:6d0fe7ce9898 |
---|---|
194 'svn+https': svnrepo}) | 194 'svn+https': svnrepo}) |
195 | 195 |
196 if hgutil.safehasattr(commands, 'optionalrepo'): | 196 if hgutil.safehasattr(commands, 'optionalrepo'): |
197 commands.optionalrepo += ' svn' | 197 commands.optionalrepo += ' svn' |
198 | 198 |
199 svnopts = [ | 199 svncommandopts = [ |
200 ('u', 'svn-url', '', 'path to the Subversion server.'), | 200 ('u', 'svn-url', '', 'path to the Subversion server.'), |
201 ('', 'stupid', False, 'be stupid and use diffy replay.'), | 201 ('', 'stupid', False, 'be stupid and use diffy replay.'), |
202 ('A', 'authors', '', 'username mapping filename'), | 202 ('A', 'authors', '', 'username mapping filename'), |
203 ('', 'filemap', '', | 203 ('', 'filemap', '', |
204 'remap file to exclude paths or include only certain paths'), | 204 'remap file to exclude paths or include only certain paths'), |
216 | 216 |
217 # set up commands and templatekeywords (written this way to maintain backwards | 217 # set up commands and templatekeywords (written this way to maintain backwards |
218 # compatibility until we drop support for 3.7 for templatekeywords and 4.3 for | 218 # compatibility until we drop support for 3.7 for templatekeywords and 4.3 for |
219 # commands) | 219 # commands) |
220 cmdtable = { | 220 cmdtable = { |
221 "svn": (svncommands.svn, svnopts, svnusage), | 221 "svn": (svncommands.svn, svncommandopts, svnusage), |
222 } | 222 } |
223 try: | 223 try: |
224 from mercurial import registrar | 224 from mercurial import registrar |
225 templatekeyword = registrar.templatekeyword() | 225 templatekeyword = registrar.templatekeyword() |
226 loadkeyword = lambda registrarobj: None # no-op | 226 loadkeyword = lambda registrarobj: None # no-op |
227 | 227 |
228 if hgutil.safehasattr(registrar, 'command'): | 228 if hgutil.safehasattr(registrar, 'command'): |
229 cmdtable = {} | 229 cmdtable = {} |
230 command = registrar.command(cmdtable) | 230 command = registrar.command(cmdtable) |
231 @command('svn', svnopts, svnusage) | 231 @command('svn', svncommandopts, svnusage) |
232 def svncommand(*args, **kwargs): | 232 def svncommand(*args, **kwargs): |
233 return svncommands.svn(*args, **kwargs) | 233 return svncommands.svn(*args, **kwargs) |
234 except (ImportError, AttributeError): | 234 except (ImportError, AttributeError): |
235 # registrar.templatekeyword isn't available = loading by old hg | 235 # registrar.templatekeyword isn't available = loading by old hg |
236 | 236 |