Mercurial > hgsubversion
comparison rebuildmeta.py @ 205:30df375590d1
Less fail with rebuildmeta url argument
author | Luke Opperman <luke@loppear.com> |
---|---|
date | Tue, 03 Mar 2009 09:35:06 -0600 |
parents | 77812f98e250 |
children | b5ef9a404f5d 2117cb0118fe |
comparison
equal
deleted
inserted
replaced
204:496ff87e2532 | 205:30df375590d1 |
---|---|
1 import os | 1 import os |
2 import pickle | 2 import pickle |
3 | 3 |
4 from mercurial import node | 4 from mercurial import node |
5 from mercurial import util as mutil | |
5 | 6 |
6 import svnwrap | 7 import svnwrap |
7 import util | 8 import util |
8 | 9 |
9 def rebuildmeta(ui, repo, hg_repo_path, args, **opts): | 10 def rebuildmeta(ui, repo, hg_repo_path, args, **opts): |
10 """rebuild hgsubversion metadata using values stored in revisions | 11 """rebuild hgsubversion metadata using values stored in revisions |
11 """ | 12 """ |
12 assert len(args) == 1, 'You must pass the svn URI used to create this repo.' | 13 if len(args) != 1: |
14 raise mutil.Abort('You must pass the svn URI used to create this repo.') | |
13 uuid = None | 15 uuid = None |
14 svn = svnwrap.SubversionRepo(url=args[0]) | 16 url = args[0].rstrip('/') |
17 svn = svnwrap.SubversionRepo(url=url) | |
15 subdir = svn.subdir | 18 subdir = svn.subdir |
16 svnmetadir = os.path.join(repo.path, 'svn') | 19 svnmetadir = os.path.join(repo.path, 'svn') |
17 if not os.path.exists(svnmetadir): | 20 if not os.path.exists(svnmetadir): |
18 os.makedirs(svnmetadir) | 21 os.makedirs(svnmetadir) |
19 | 22 |
36 'right location in the repo.') | 39 'right location in the repo.') |
37 if uuid is None: | 40 if uuid is None: |
38 uuid = convinfo[4:40] | 41 uuid = convinfo[4:40] |
39 assert uuid == svn.uuid, 'UUIDs did not match!' | 42 assert uuid == svn.uuid, 'UUIDs did not match!' |
40 urlfile = open(os.path.join(svnmetadir, 'url'), 'w') | 43 urlfile = open(os.path.join(svnmetadir, 'url'), 'w') |
41 urlfile.write(args[0]) | 44 urlfile.write(url) |
42 urlfile.close() | 45 urlfile.close() |
43 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') | 46 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') |
44 uuidfile.write(uuid) | 47 uuidfile.write(uuid) |
45 uuidfile.close() | 48 uuidfile.close() |
46 commitpath = revpath[len(subdir)+1:] | 49 commitpath = revpath[len(subdir)+1:] |