comparison hgext/convert/__init__.py @ 21769:4a54d9f1b6b6

convert: define norepo in command decorator
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 22:02:25 -0700
parents f0dbafceeb9a
children 35ab037de989
comparison
equal deleted inserted replaced
21768:16aeb28caaa6 21769:4a54d9f1b6b6
8 '''import revisions from foreign VCS repositories into Mercurial''' 8 '''import revisions from foreign VCS repositories into Mercurial'''
9 9
10 import convcmd 10 import convcmd
11 import cvsps 11 import cvsps
12 import subversion 12 import subversion
13 from mercurial import cmdutil, commands, templatekw 13 from mercurial import cmdutil, templatekw
14 from mercurial.i18n import _ 14 from mercurial.i18n import _
15 15
16 cmdtable = {} 16 cmdtable = {}
17 command = cmdutil.command(cmdtable) 17 command = cmdutil.command(cmdtable)
18 testedwith = 'internal' 18 testedwith = 'internal'
35 _('FILE')), 35 _('FILE')),
36 ('', 'branchsort', None, _('try to sort changesets by branches')), 36 ('', 'branchsort', None, _('try to sort changesets by branches')),
37 ('', 'datesort', None, _('try to sort changesets by date')), 37 ('', 'datesort', None, _('try to sort changesets by date')),
38 ('', 'sourcesort', None, _('preserve source changesets order')), 38 ('', 'sourcesort', None, _('preserve source changesets order')),
39 ('', 'closesort', None, _('try to reorder closed revisions'))], 39 ('', 'closesort', None, _('try to reorder closed revisions'))],
40 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]')) 40 _('hg convert [OPTION]... SOURCE [DEST [REVMAP]]'),
41 norepo=True)
41 def convert(ui, src, dest=None, revmapfile=None, **opts): 42 def convert(ui, src, dest=None, revmapfile=None, **opts):
42 """convert a foreign SCM repository to a Mercurial one. 43 """convert a foreign SCM repository to a Mercurial one.
43 44
44 Accepted source formats [identifiers]: 45 Accepted source formats [identifiers]:
45 46
301 :convert.hg.usebranchnames: preserve branch names. The default is 302 :convert.hg.usebranchnames: preserve branch names. The default is
302 True. 303 True.
303 """ 304 """
304 return convcmd.convert(ui, src, dest, revmapfile, **opts) 305 return convcmd.convert(ui, src, dest, revmapfile, **opts)
305 306
306 @command('debugsvnlog', [], 'hg debugsvnlog') 307 @command('debugsvnlog', [], 'hg debugsvnlog', norepo=True)
307 def debugsvnlog(ui, **opts): 308 def debugsvnlog(ui, **opts):
308 return subversion.debugsvnlog(ui, **opts) 309 return subversion.debugsvnlog(ui, **opts)
309 310
310 @command('debugcvsps', 311 @command('debugcvsps',
311 [ 312 [
322 ('', 'parents', '', _('show parent changesets')), 323 ('', 'parents', '', _('show parent changesets')),
323 ('', 'ancestors', '', _('show current changeset in ancestor branches')), 324 ('', 'ancestors', '', _('show current changeset in ancestor branches')),
324 # Options that are ignored for compatibility with cvsps-2.1 325 # Options that are ignored for compatibility with cvsps-2.1
325 ('A', 'cvs-direct', None, _('ignored for compatibility')), 326 ('A', 'cvs-direct', None, _('ignored for compatibility')),
326 ], 327 ],
327 _('hg debugcvsps [OPTION]... [PATH]...')) 328 _('hg debugcvsps [OPTION]... [PATH]...'),
329 norepo=True)
328 def debugcvsps(ui, *args, **opts): 330 def debugcvsps(ui, *args, **opts):
329 '''create changeset information from CVS 331 '''create changeset information from CVS
330 332
331 This command is intended as a debugging tool for the CVS to 333 This command is intended as a debugging tool for the CVS to
332 Mercurial converter, and can be used as a direct replacement for 334 Mercurial converter, and can be used as a direct replacement for
335 Hg debugcvsps reads the CVS rlog for current directory (or any 337 Hg debugcvsps reads the CVS rlog for current directory (or any
336 named directory) in the CVS repository, and converts the log to a 338 named directory) in the CVS repository, and converts the log to a
337 series of changesets based on matching commit log entries and 339 series of changesets based on matching commit log entries and
338 dates.''' 340 dates.'''
339 return cvsps.debugcvsps(ui, *args, **opts) 341 return cvsps.debugcvsps(ui, *args, **opts)
340
341 commands.norepo += " convert debugsvnlog debugcvsps"
342 342
343 def kwconverted(ctx, name): 343 def kwconverted(ctx, name):
344 rev = ctx.extra().get('convert_revision', '') 344 rev = ctx.extra().get('convert_revision', '')
345 if rev.startswith('svn:'): 345 if rev.startswith('svn:'):
346 if name == 'svnrev': 346 if name == 'svnrev':