Mercurial > hgsubversion
comparison svncommand.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 | 57355b0e7bd1 |
| children | de3807ceea5c |
comparison
equal
deleted
inserted
replaced
| 195:906d3f302b45 | 196:77812f98e250 |
|---|---|
| 7 from mercurial import node | 7 from mercurial import node |
| 8 from mercurial import util as merc_util | 8 from mercurial import util as merc_util |
| 9 | 9 |
| 10 import svnwrap | 10 import svnwrap |
| 11 import util | 11 import util |
| 12 from util import register_subcommand, svn_subcommands, generate_help | 12 from util import register_subcommand, svn_subcommands, generate_help, svn_commands_nourl |
| 13 # dirty trick to force demandimport to run my decorator anyway. | 13 # dirty trick to force demandimport to run my decorator anyway. |
| 14 from utility_commands import print_wc_url | 14 from utility_commands import print_wc_url |
| 15 from fetch_command import fetch_revisions | 15 from fetch_command import fetch_revisions |
| 16 from push_cmd import commit_from_rev | 16 from push_cmd import commit_from_rev |
| 17 from diff_cmd import diff_command | 17 from diff_cmd import diff_command |
| 32 candidates.append(c) | 32 candidates.append(c) |
| 33 if len(candidates) == 1: | 33 if len(candidates) == 1: |
| 34 subcommand = candidates[0] | 34 subcommand = candidates[0] |
| 35 path = os.path.dirname(repo.path) | 35 path = os.path.dirname(repo.path) |
| 36 try: | 36 try: |
| 37 if subcommand != 'rebuildmeta': | 37 commandfunc = svn_subcommands[subcommand] |
| 38 if commandfunc not in svn_commands_nourl: | |
| 38 opts['svn_url'] = open(os.path.join(repo.path, 'svn', 'url')).read() | 39 opts['svn_url'] = open(os.path.join(repo.path, 'svn', 'url')).read() |
| 39 return svn_subcommands[subcommand](ui, args=args, | 40 return commandfunc(ui, args=args, |
| 40 hg_repo_path=path, | 41 hg_repo_path=path, |
| 41 repo=repo, | 42 repo=repo, |
| 42 **opts) | 43 **opts) |
| 43 except TypeError: | 44 except TypeError: |
| 44 tb = traceback.extract_tb(sys.exc_info()[2]) | 45 tb = traceback.extract_tb(sys.exc_info()[2]) |
| 45 if len(tb) == 1: | 46 if len(tb) == 1: |
| 46 ui.status('Bad arguments for subcommand %s\n' % subcommand) | 47 ui.status('Bad arguments for subcommand %s\n' % subcommand) |
| 47 else: | 48 else: |
