comparison util.py @ 196:77812f98e250

Add a naive hg svn version command that works as long as hgsubversion is run from a checkout.
author Augie Fackler <durin42@gmail.com>
date Tue, 10 Feb 2009 14:52:26 -0600
parents 906d3f302b45
children df4611050286
comparison
equal deleted inserted replaced
195:906d3f302b45 196:77812f98e250
1 import os 1 import os
2 import shutil 2 import shutil
3 3
4 from mercurial import hg
4 from mercurial import node 5 from mercurial import node
5 6
6 svn_subcommands = { } 7 svn_subcommands = { }
7
8 def register_subcommand(name): 8 def register_subcommand(name):
9 def inner(fn): 9 def inner(fn):
10 svn_subcommands[name] = fn 10 svn_subcommands[name] = fn
11 return fn 11 return fn
12 return inner 12 return inner
13
14 svn_commands_nourl = set()
15 def command_needs_no_url(fn):
16 svn_commands_nourl.add(fn)
17 return fn
18
19
20 def version(ui):
21 """Guess the version of hgsubversion.
22 """
23 # TODO make this say something other than "unknown" for installed hgsubversion
24 repo = hg.repository(ui, os.path.dirname(__file__))
25 ver = repo.dirstate.parents()[0]
26 return node.hex(ver)[:12]
13 27
14 28
15 def generate_help(): 29 def generate_help():
16 ret = ['hg svn ...', '', 30 ret = ['hg svn ...', '',
17 'subcommands for Subversion integration', '', 31 'subcommands for Subversion integration', '',