##// END OF EJS Templates
convert: add svnrev, svnpath and svnuuid template keywords...
Patrick Mezard -
r13691:ad02eba5 default
parent child Browse files
Show More
@@ -10,7 +10,7 b''
10 10 import convcmd
11 11 import cvsps
12 12 import subversion
13 from mercurial import commands
13 from mercurial import commands, templatekw
14 14 from mercurial.i18n import _
15 15
16 16 # Commands definition was moved elsewhere to ease demandload job.
@@ -334,3 +334,31 b' cmdtable = {'
334 334 ],
335 335 _('hg debugcvsps [OPTION]... [PATH]...')),
336 336 }
337
338 def kwconverted(ctx, name):
339 rev = ctx.extra().get('convert_revision', '')
340 if rev.startswith('svn:'):
341 if name == 'svnrev':
342 return str(subversion.revsplit(rev)[2])
343 elif name == 'svnpath':
344 return subversion.revsplit(rev)[1]
345 elif name == 'svnuuid':
346 return subversion.revsplit(rev)[0]
347 return rev
348
349 def kwsvnrev(repo, ctx, **args):
350 """:svnrev: String. Converted subversion revision number."""
351 return kwconverted(ctx, 'svnrev')
352
353 def kwsvnpath(repo, ctx, **args):
354 """:svnpath: String. Converted subversion revision project path."""
355 return kwconverted(ctx, 'svnpath')
356
357 def kwsvnuuid(repo, ctx, **args):
358 """:svnuuid: String. Converted subversion revision repository identifier."""
359 return kwconverted(ctx, 'svnuuid')
360
361 def extsetup(ui):
362 templatekw.keywords['svnrev'] = kwsvnrev
363 templatekw.keywords['svnpath'] = kwsvnpath
364 templatekw.keywords['svnuuid'] = kwsvnuuid
@@ -32,6 +32,21 b' Convert trunk and branches'
32 32 1 move back to old
33 33 0 last change to a
34 34
35 Test template keywords
36
37 $ hg -R A-hg log --template '{rev} {svnuuid}{svnpath}@{svnrev}\n'
38 10 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@10
39 9 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@9
40 8 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old2@8
41 7 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@7
42 6 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@6
43 5 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@6
44 4 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@5
45 3 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@4
46 2 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@3
47 1 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@2
48 0 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@1
49
35 50 Convert again
36 51
37 52 $ hg convert --branchmap=branchmap --datesort svn-repo A-hg
General Comments 0
You need to be logged in to leave comments. Login now