comparison svncommands.py @ 331:75f082b5897e

Switch to using url scheme wrappers instead of duplicating each command we wrap. The 'hg svn url' command has been killed; the replacement is '.hg/hgrc'. More stuff related to its disappearance has been stripped, including two tests. HgChangeReceiver now takes a UUID argument, which it uses to ensure that remote repositories remain unchanged. This is a temporary solution, and I'm not entirely satisfied with how it's done either. Access to the UUID file has been isolated in a HgChangeReceiver property. Some more tests have been updated to use ui.pushbuffer()/popbuffer(), and to pass through the Mercurial API. Moved the arguments to wrappers.pull() to the UI configuration. Also, remove HgChangeReceiver.opts in favour of a 'usebranchnames' instance & configuration variable. The name is taken from the ConvertExtension.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 15 May 2009 19:18:43 +0200
parents 1d48d9a34c19
children
comparison
equal deleted inserted replaced
330:5f8f2fd4fd54 331:75f082b5897e
28 ui_=ui, 28 ui_=ui,
29 subdir=svn.subdir, 29 subdir=svn.subdir,
30 author_host=author_host, 30 author_host=author_host,
31 tag_locations=tag_locations, 31 tag_locations=tag_locations,
32 authors=authors, 32 authors=authors,
33 filemap=filemap) 33 filemap=filemap,
34 if os.path.exists(hg_editor.uuid_file): 34 uuid=svn.uuid)
35 uuid = open(hg_editor.uuid_file).read() 35 start = max(hg_editor.last_known_revision(), skipto_rev)
36 assert uuid == svn.uuid 36 initializing_repo = (hg_editor.last_known_revision() <= 0)
37 start = hg_editor.last_known_revision()
38 else:
39 open(hg_editor.uuid_file, 'w').write(svn.uuid)
40 open(hg_editor.svn_url_file, 'w').write(svn_url)
41 initializing_repo = True
42 start = skipto_rev
43 37
44 if initializing_repo and start > 0: 38 if initializing_repo and start > 0:
45 raise hgutil.Abort('Revision skipping at repository initialization ' 39 raise hgutil.Abort('Revision skipping at repository initialization '
46 'remains unimplemented.') 40 'remains unimplemented.')
47 41
63 57
64 def rebuildmeta(ui, repo, hg_repo_path, args, **opts): 58 def rebuildmeta(ui, repo, hg_repo_path, args, **opts):
65 """rebuild hgsubversion metadata using values stored in revisions 59 """rebuild hgsubversion metadata using values stored in revisions
66 """ 60 """
67 if len(args) != 1: 61 if len(args) != 1:
68 raise hgutil.Abort('You must pass the svn URI used to create this repo.') 62 url = repo.ui.expandpath(dest or 'default-push', dest or 'default')
63 else:
64 url = args[0]
65 if not (url.startswith('svn+') or url.startswith('svn:')):
66 raise hgutil.Abort('No valid Subversion URI found; please specify one.')
69 uuid = None 67 uuid = None
70 url = args[0].rstrip('/') 68 url = util.normalize_url(url.rstrip('/'))
71 user, passwd = util.getuserpass(opts) 69 user, passwd = util.getuserpass(opts)
72 svn = svnwrap.SubversionRepo(url, user, passwd) 70 svn = svnwrap.SubversionRepo(url, user, passwd)
73 subdir = svn.subdir 71 subdir = svn.subdir
74 svnmetadir = os.path.join(repo.path, 'svn') 72 svnmetadir = os.path.join(repo.path, 'svn')
75 if not os.path.exists(svnmetadir): 73 if not os.path.exists(svnmetadir):
93 assert revpath.startswith(subdir), ('That does not look like the ' 91 assert revpath.startswith(subdir), ('That does not look like the '
94 'right location in the repo.') 92 'right location in the repo.')
95 if uuid is None: 93 if uuid is None:
96 uuid = convinfo[4:40] 94 uuid = convinfo[4:40]
97 assert uuid == svn.uuid, 'UUIDs did not match!' 95 assert uuid == svn.uuid, 'UUIDs did not match!'
98 urlfile = open(os.path.join(svnmetadir, 'url'), 'w')
99 urlfile.write(url)
100 urlfile.close()
101 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w') 96 uuidfile = open(os.path.join(svnmetadir, 'uuid'), 'w')
102 uuidfile.write(uuid) 97 uuidfile.write(uuid)
103 uuidfile.close() 98 uuidfile.close()
104 commitpath = revpath[len(subdir)+1:] 99 commitpath = revpath[len(subdir)+1:]
105 if commitpath.startswith('branches'): 100 if commitpath.startswith('branches'):