summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-11-05 11:12:21 +0000
committerRichard Maw <richard.maw@gmail.com>2014-11-05 11:12:21 +0000
commit9fe25bf02dceec04f0ffd6a05cc47146ceab9904 (patch)
tree667cb781be038b34dbeaffaec47dbf4493ccf45c
parentede3f337e9769b0e6756d4b9cc37d33aa62b82ba (diff)
parente384002ca3bd66c6e90aeaf6b3ddaea0b66b0a81 (diff)
downloadlorry-9fe25bf02dceec04f0ffd6a05cc47146ceab9904.tar.gz
Merge branch 'baserock/richardmaw/lars-url-change-fix'
Reviewed-by: Richard Maw Reviewed-by: Daniel Silverstone
-rwxr-xr-xlorry55
1 files changed, 34 insertions, 21 deletions
diff --git a/lorry b/lorry
index 853c65d..127a1fb 100755
--- a/lorry
+++ b/lorry
@@ -396,37 +396,45 @@ class Lorry(cliapp.Application):
os.remove(exports[branch])
def gitify_svn(self, project_name, dirname, gitdir, spec):
+ layout = spec["layout"]
+ # if standard layour specified, fill in the defaults
+ if layout == "standard":
+ layout = { "trunk": "trunk",
+ "tags": "tags/*",
+ "branches": "branches/*" }
if not os.path.exists(gitdir):
self.progress('.. doing initial clone')
self.needs_aggressive = True
- layout = spec["layout"]
- # if standard layour specified, fill in the defaults
- if layout == "standard":
- layout = { "trunk": "trunk",
- "tags": "tags/*",
- "branches": "branches/*" }
- # init the repo then manually set the refspecs to fetch into local
- # git-svn can apparently provide better history tracking by
- # fetching the root of the repository
- # git-svn will convert branch, trunk and tag paths to allow this,
- # but it is simpler to disable it and do it manually
self.run_program(['git', 'svn', 'init', spec['url'], gitdir + "-tmp",
'--svn-remote=svn', '--no-minimize-url'])
os.rename(os.path.join(gitdir + "-tmp", '.git'), gitdir)
os.rmdir(gitdir + "-tmp")
self.run_program(['git', 'config', 'core.bare', 'true'],
cwd=gitdir)
- self.run_program(['git', 'config', 'svn-remote.svn.fetch',
- layout["trunk"]+':refs/heads/master'],
- cwd=gitdir)
- self.run_program(['git', 'config', 'svn-remote.svn.branches',
- layout["branches"] + ':refs/heads/*'],
- cwd=gitdir)
- self.run_program(['git', 'config', 'svn-remote.svn.tags',
- layout["tags"] + ':refs/tags/*'],
- cwd=gitdir)
else:
self.progress('.. updating existing clone')
+
+ # Force URL to the one in the Lorry spec. This way, if the
+ # URL in the spec changes, Lorry accepts the change rather
+ # than using the original one.
+ self.run_program(
+ ['git', 'config', 'svn-remote.svn.url', spec['url']],
+ cwd=gitdir)
+ # manually set the refspecs to fetch into local
+ # git-svn can apparently provide better history tracking by
+ # fetching the root of the repository
+ # git-svn will convert branch, trunk and tag paths to allow this,
+ # but it is simpler to disable it and do it manually
+ self.run_program(['git', 'config', 'svn-remote.svn.fetch',
+ layout["trunk"]+':refs/heads/master'],
+ cwd=gitdir)
+ self.run_program(['git', 'config', 'svn-remote.svn.branches',
+ layout["branches"] + ':refs/heads/*'],
+ cwd=gitdir)
+ self.run_program(['git', 'config', 'svn-remote.svn.tags',
+ layout["tags"] + ':refs/tags/*'],
+ cwd=gitdir)
+
# update the remote tracking branches
self.run_program(['git', 'svn', 'fetch'], cwd=gitdir)
@@ -443,7 +451,12 @@ class Lorry(cliapp.Application):
hgdir = os.path.join(dirname, 'hg')
if os.path.exists(hgdir):
self.progress('.. updating hg branch')
- self.run_program(['hg', 'pull', '--quiet', '--insecure'], cwd=hgdir)
+
+ # Note that we always specify the URL from the spec, so
+ # that if the spec changes, we pick up the new URL.
+ self.run_program(
+ ['hg', 'pull', '--quiet', '--insecure', spec['url']],
+ cwd=hgdir)
else:
self.progress('.. doing initial hg branch')
self.run_program(['hg', 'clone', '--quiet', '--insecure', spec['url'], hgdir])