summaryrefslogtreecommitdiff
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
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
-rw-r--r--README1
-rwxr-xr-xlorry34
2 files changed, 28 insertions, 7 deletions
diff --git a/README b/README
index c9c116e..ad6cb9a 100644
--- a/README
+++ b/README
@@ -120,6 +120,7 @@ This is equivalent to
Trunk is the path to the directory where the main branch is located.
Branches and Tags are glob expressions to allow finer control over which paths
are used.
+Trunk is mandatory, but Branches and Tags are optional.
Texlive keeps a lot of resources in their svn repository, we are only concerned
with the source code, so this layout should select the correct subdirectory for
each branch.
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)