13
13
# or
14
14
# % git clone bzr::lp:myrepo
15
15
#
16
- # If you want to specify which branches you want track (per repo):
17
- # git config remote-bzr.branches 'trunk, devel, test'
16
+ # If you want to specify which branches you want to track (per repo):
17
+ # % git config remote.origin.bzr-branches 'trunk, devel, test'
18
+ #
19
+ # Where 'origin' is the name of the repository you want to specify the
20
+ # branches.
18
21
#
19
22
20
23
import sys
@@ -168,17 +171,16 @@ class Parser:
168
171
if not m :
169
172
return None
170
173
_ , name , email , date , tz = m .groups ()
174
+ name = name .decode ('utf-8' )
171
175
committer = '%s <%s>' % (name , email )
172
176
tz = int (tz )
173
177
tz = ((tz / 100 ) * 3600 ) + ((tz % 100 ) * 60 )
174
178
return (committer , int (date ), tz )
175
179
176
180
def rev_to_mark (rev ):
177
- global marks
178
181
return marks .from_rev (rev )
179
182
180
183
def mark_to_rev (mark ):
181
- global marks
182
184
return marks .to_rev (mark )
183
185
184
186
def fixup_user (user ):
@@ -233,8 +235,6 @@ def get_filechanges(cur, prev):
233
235
return modified , removed
234
236
235
237
def export_files (tree , files ):
236
- global marks , filenodes
237
-
238
238
final = []
239
239
for path , fid in files .iteritems ():
240
240
kind = tree .kind (fid )
@@ -276,8 +276,6 @@ def export_files(tree, files):
276
276
return final
277
277
278
278
def export_branch (repo , name ):
279
- global prefix
280
-
281
279
ref = '%s/heads/%s' % (prefix , name )
282
280
tip = marks .get_tip (name )
283
281
@@ -378,16 +376,12 @@ def export_branch(repo, name):
378
376
marks .set_tip (name , revid )
379
377
380
378
def export_tag (repo , name ):
381
- global tags , prefix
382
-
383
379
ref = '%s/tags/%s' % (prefix , name )
384
380
print "reset %s" % ref
385
381
print "from :%u" % rev_to_mark (tags [name ])
386
382
print
387
383
388
384
def do_import (parser ):
389
- global dirname
390
-
391
385
repo = parser .repo
392
386
path = os .path .join (dirname , 'marks-git' )
393
387
@@ -413,8 +407,6 @@ def do_import(parser):
413
407
sys .stdout .flush ()
414
408
415
409
def parse_blob (parser ):
416
- global blob_marks
417
-
418
410
parser .next ()
419
411
mark = parser .get_mark ()
420
412
parser .next ()
@@ -425,8 +417,6 @@ def parse_blob(parser):
425
417
class CustomTree ():
426
418
427
419
def __init__ (self , branch , revid , parents , files ):
428
- global files_cache
429
-
430
420
self .updates = {}
431
421
self .branch = branch
432
422
@@ -484,7 +474,7 @@ class CustomTree():
484
474
add_entry (fid , dirname , 'directory' )
485
475
return fid
486
476
487
- def add_entry (fid , path , kind , mode = None ):
477
+ def add_entry (fid , path , kind , mode = None ):
488
478
dirname , basename = os .path .split (path )
489
479
parent_fid = get_parent (dirname , basename )
490
480
@@ -505,7 +495,7 @@ class CustomTree():
505
495
self .files [path ] = [change [0 ], None ]
506
496
changes .append (change )
507
497
508
- def update_entry (fid , path , kind , mode = None ):
498
+ def update_entry (fid , path , kind , mode = None ):
509
499
dirname , basename = os .path .split (path )
510
500
parent_fid = get_parent (dirname , basename )
511
501
@@ -583,9 +573,6 @@ def c_style_unescape(string):
583
573
return string
584
574
585
575
def parse_commit (parser ):
586
- global marks , blob_marks , parsed_refs
587
- global mode
588
-
589
576
parents = []
590
577
591
578
ref = parser [1 ]
@@ -657,8 +644,6 @@ def parse_commit(parser):
657
644
marks .new_mark (revid , commit_mark )
658
645
659
646
def parse_reset (parser ):
660
- global parsed_refs
661
-
662
647
ref = parser [1 ]
663
648
parser .next ()
664
649
@@ -674,8 +659,6 @@ def parse_reset(parser):
674
659
parsed_refs [ref ] = mark_to_rev (from_mark )
675
660
676
661
def do_export (parser ):
677
- global parsed_refs , dirname , transports
678
-
679
662
parser .next ()
680
663
681
664
for line in parser .each_block ('done' ):
@@ -725,8 +708,6 @@ def do_export(parser):
725
708
print
726
709
727
710
def do_capabilities (parser ):
728
- global dirname
729
-
730
711
print "import"
731
712
print "export"
732
713
print "refspec refs/heads/*:%s/heads/*" % prefix
@@ -744,8 +725,6 @@ def ref_is_valid(name):
744
725
return not True in [c in name for c in '~^: \\ ' ]
745
726
746
727
def do_list (parser ):
747
- global tags
748
-
749
728
master_branch = None
750
729
751
730
for name in branches :
@@ -770,7 +749,6 @@ def do_list(parser):
770
749
print
771
750
772
751
def clone (path , remote_branch ):
773
- global transports
774
752
try :
775
753
bdir = bzrlib .bzrdir .BzrDir .create (path , possible_transports = transports )
776
754
except bzrlib .errors .AlreadyControlDirError :
@@ -780,8 +758,6 @@ def clone(path, remote_branch):
780
758
return remote_branch .sprout (bdir , repository = repo )
781
759
782
760
def get_remote_branch (name ):
783
- global dirname , branches , transports
784
-
785
761
remote_branch = bzrlib .branch .Branch .open (branches [name ],
786
762
possible_transports = transports )
787
763
if isinstance (remote_branch .user_transport , bzrlib .transport .local .LocalTransport ):
@@ -825,8 +801,6 @@ def find_branches(repo):
825
801
yield name , branch .base
826
802
827
803
def get_repo (url , alias ):
828
- global dirname , peer , branches , transports
829
-
830
804
normal_url = bzrlib .urlutils .normalize_url (url )
831
805
origin = bzrlib .bzrdir .BzrDir .open (url , possible_transports = transports )
832
806
is_local = isinstance (origin .transport , bzrlib .transport .local .LocalTransport )
@@ -858,9 +832,13 @@ def get_repo(url, alias):
858
832
except bzrlib .errors .NoRepositoryPresent :
859
833
pass
860
834
861
- wanted = get_config ('remote-bzr. branches' ).rstrip ().split (', ' )
835
+ wanted = get_config ('remote.%s.bzr- branches' % alias ).rstrip ().split (', ' )
862
836
# stupid python
863
837
wanted = [e for e in wanted if e ]
838
+ if not wanted :
839
+ wanted = get_config ('remote-bzr.branches' ).rstrip ().split (', ' )
840
+ # stupid python
841
+ wanted = [e for e in wanted if e ]
864
842
865
843
if not wanted :
866
844
try :
0 commit comments