diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 11:38:18 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 11:38:18 +0000 |
commit | 031c9067cd3ede80a8c7467e9bf6a55749a6f3cd (patch) | |
tree | d2b84b05d52fe351b13cfed330327849904f1513 | |
parent | 565d7f739a1e82de22daae57d5a5b3a692abf8c9 (diff) | |
download | lorry-031c9067cd3ede80a8c7467e9bf6a55749a6f3cd.tar.gz |
lorry: use refspecs in lorry files
If refspecs are listed, pass them to push_to_mirror_server, if not
allow push_to_mirror_server to use its default refspecs
Also fix test cases:
- refs/tags/rc* is not a valid refspec,
* can only substitute a whole directory
- git-for-each-ref needs the whole ref path, master is not the
same as refs/heads/master
-rwxr-xr-x | lorry | 5 | ||||
-rwxr-xr-x | tests/pushspecs-only.script | 4 | ||||
-rwxr-xr-x | tests/setup_once | 4 |
3 files changed, 8 insertions, 5 deletions
@@ -155,7 +155,10 @@ class Lorry(cliapp.Application): '--window=250'], cwd=gitdir) self.bundle(name, gitdir) if not self.settings['pull-only']: - self.push_to_mirror_server(gitdir) + if 'refspecs' in spec: + self.push_to_mirror_server(gitdir, spec['refspecs']) + else: + self.push_to_mirror_server(gitdir) def add_remote(self, name, gitdir): diff --git a/tests/pushspecs-only.script b/tests/pushspecs-only.script index 1be8fb3..787cc38 100755 --- a/tests/pushspecs-only.script +++ b/tests/pushspecs-only.script @@ -31,7 +31,7 @@ cat >"$lorryfile" <<EOF "url": "file://$git_upstream", "refspecs": [ "master", - "refs/tags/rc*" + "refs/tags/rc/*" ] } } @@ -48,5 +48,5 @@ git init --quiet --bare "$mirror_path"/pushspecs.git allrefs="$(cd "$mirror_path"/pushspecs.git && git for-each-ref | sort)" wantedrefs="$(cd "$mirror_path"/pushspecs.git && - git for-each-ref master 'refs/tags/rc*' | sort)" + git for-each-ref refs/heads/master 'refs/tags/rc/*' | sort)" test "$allrefs" = "$wantedrefs" diff --git a/tests/setup_once b/tests/setup_once index afaaaf0..ec039b7 100755 --- a/tests/setup_once +++ b/tests/setup_once @@ -38,7 +38,7 @@ git add newfile.txt git commit --quiet -m 'add newfile.txt' git checkout master git merge topic/newfile -git tag rc1 +git tag rc/1 git checkout topic/morelines for i in `seq 2 10`; do echo line $i >>file.txt @@ -46,5 +46,5 @@ done git commit --quiet -m 'add more lines' file.txt git checkout master git merge topic/morelines -git tag rc2 +git tag rc/2 |