summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-07-03 15:05:03 +0100
committerBaserock Gerrit <gerrit@baserock.org>2015-09-24 09:24:53 +0000
commit37ebbacd09145fa6bbaf54dac2a211a5d83f01a5 (patch)
tree6ee9d633c814ec809e96d8c5cd9804a5786c0cd3 /lorry
parent3455c3c77ca778527efbd4541d3be1fb09f37bcf (diff)
downloadlorry-37ebbacd09145fa6bbaf54dac2a211a5d83f01a5.tar.gz
Make branches and tags optional
Some svn repos don't have a branches dir or a tags dir in their layout. This will for example allow us to lorry xmlto with the following lorry, { "xmlto": { "type": "svn", "url": "http://svn.fedorahosted.org/svn/xmlto", "layout": { "trunk": "." } } } Change-Id: I74c032ab7642f4b22ed0569b2a163c0b78cba658
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry34
1 files changed, 27 insertions, 7 deletions
diff --git a/lorry b/lorry
index aa87d52..2759f54 100755
--- a/lorry
+++ b/lorry
@@ -436,15 +436,35 @@ class Lorry(cliapp.Application):
# 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/*'],
+ layout["trunk"] + ':refs/heads/master'],
cwd=gitdir)
+ if 'branches' in layout:
+ self.run_program(['git', 'config', 'svn-remote.svn.branches',
+ layout["branches"] + ':refs/heads/*'],
+ cwd=gitdir)
+ else:
+ # try removing old config
+ try:
+ self.run_program(['git', 'config', '--unset',
+ 'svn-remote.svn.branches'], cwd=gitdir)
+ except Exception as e:
+ if '(exit code 5)' not in e.message:
+ raise
+
+ if 'tags' in layout:
+ self.run_program(['git', 'config', 'svn-remote.svn.tags',
+ layout["tags"] + ':refs/tags/*'],
+ cwd=gitdir)
+ else:
+ # try removing old config
+ try:
+ self.run_program(['git', 'config', '--unset',
+ 'svn-remote.svn.tags'], cwd=gitdir)
+ except Exception as e:
+ if '(exit code 5)' not in e.message:
+ raise
+
# update the remote tracking branches
self.run_program(['git', 'svn', 'fetch'], cwd=gitdir)