Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote-bzr: add option to specify branches
author
Felipe Contreras
<felipe.contreras@gmail.com>
Wed, 1 May 2013 01:10:06 +0000
(20:10 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 1 May 2013 05:06:47 +0000
(22:06 -0700)
We might not want all the branches. And branch handling in bazaar is
rather tricky, so it's safer to simply specify them.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-bzr
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
850dd25
)
diff --git
a/contrib/remote-helpers/git-remote-bzr
b/contrib/remote-helpers/git-remote-bzr
index 11f24152bf111e5d7a4e38960f9cbeab64156cb9..d284afc0d3efe3a47216f0addd5b0da0c03e8096 100755
(executable)
--- a/
contrib/remote-helpers/git-remote-bzr
+++ b/
contrib/remote-helpers/git-remote-bzr
@@
-13,6
+13,9
@@
# or
# % git clone bzr::lp:myrepo
#
# or
# % git clone bzr::lp:myrepo
#
+# If you want to specify which branches you want track (per repo):
+# git config remote-bzr.branches 'trunk, devel, test'
+#
import sys
import sys
@@
-51,6
+54,12
@@
def warn(msg, *args):
def gittz(tz):
return '%+03d%02d' % (tz / 3600, tz % 3600 / 60)
def gittz(tz):
return '%+03d%02d' % (tz / 3600, tz % 3600 / 60)
+def get_config(config):
+ cmd = ['git', 'config', '--get', config]
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output, _ = process.communicate()
+ return output
+
class Marks:
def __init__(self, path):
class Marks:
def __init__(self, path):
@@
-756,7
+765,7
@@
def get_remote_branch(origin, remote_branch, name):
return branch
return branch
-def find_branches(repo):
+def find_branches(repo
, wanted
):
transport = repo.user_transport
for fn in transport.iter_files_recursive():
transport = repo.user_transport
for fn in transport.iter_files_recursive():
@@
-767,6
+776,9
@@
def find_branches(repo):
name = name if name != '' else 'master'
name = name.replace('/', '+')
name = name if name != '' else 'master'
name = name.replace('/', '+')
+ if wanted and not name in wanted:
+ continue
+
try:
cur = transport.clone(subdir)
branch = bzrlib.branch.Branch.open_from_transport(cur)
try:
cur = transport.clone(subdir)
branch = bzrlib.branch.Branch.open_from_transport(cur)
@@
-815,7
+827,11
@@
def get_repo(url, alias):
else:
# repository
else:
# repository
- for name, branch in find_branches(repo):
+ wanted = get_config('remote-bzr.branches').rstrip().split(', ')
+ # stupid python
+ wanted = [e for e in wanted if e]
+
+ for name, branch in find_branches(repo, wanted):
if not is_local:
peers[name] = branch
if not is_local:
peers[name] = branch