From e384002ca3bd66c6e90aeaf6b3ddaea0b66b0a81 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 5 Nov 2014 10:48:23 +0000 Subject: Unconditionally update svn refspecs Similar to the url config change, if we need to change the refspecs for which branches to pull, then we need to apply them at every run, rather than just the first run. --- lorry | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lorry b/lorry index 898ee4c..127a1fb 100755 --- a/lorry +++ b/lorry @@ -396,35 +396,21 @@ 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') @@ -434,6 +420,20 @@ class Lorry(cliapp.Application): 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) -- cgit v1.2.1