@@ -257,7 +257,8 @@ def export_branch(branch, name):
257
257
tip = marks .get_tip (name )
258
258
259
259
repo = branch .repository
260
- repo .lock_read ()
260
+
261
+ branch .lock_read ()
261
262
revs = branch .iter_merge_sorted_revisions (None , tip , 'exclude' , 'forward' )
262
263
count = 0
263
264
@@ -325,7 +326,7 @@ def export_branch(branch, name):
325
326
print "progress revision %s (%d/%d)" % (revid , count , len (revs ))
326
327
print "#############################################################"
327
328
328
- repo .unlock ()
329
+ branch .unlock ()
329
330
330
331
revid = branch .last_revision ()
331
332
@@ -383,21 +384,21 @@ def parse_blob(parser):
383
384
384
385
class CustomTree ():
385
386
386
- def __init__ (self , repo , revid , parents , files ):
387
+ def __init__ (self , branch , revid , parents , files ):
387
388
global files_cache
388
389
389
390
self .updates = {}
390
- self .branch = repo
391
+ self .branch = branch
391
392
392
393
def copy_tree (revid ):
393
394
files = files_cache [revid ] = {}
394
- repo .lock_read ()
395
- tree = repo .repository .revision_tree (revid )
395
+ branch .lock_read ()
396
+ tree = branch .repository .revision_tree (revid )
396
397
try :
397
398
for path , entry in tree .iter_entries_by_dir ():
398
399
files [path ] = [entry .file_id , None ]
399
400
finally :
400
- repo .unlock ()
401
+ branch .unlock ()
401
402
return files
402
403
403
404
if len (parents ) == 0 :
@@ -587,20 +588,20 @@ def parse_commit(parser):
587
588
path = c_style_unescape (path ).decode ('utf-8' )
588
589
files [path ] = f
589
590
590
- repo = parser .repo
591
+ branch = parser .repo
591
592
592
593
committer , date , tz = committer
593
594
parents = [str (mark_to_rev (p )) for p in parents ]
594
595
revid = bzrlib .generate_ids .gen_revision_id (committer , date )
595
596
props = {}
596
- props ['branch-nick' ] = repo .nick
597
+ props ['branch-nick' ] = branch .nick
597
598
598
- mtree = CustomTree (repo , revid , parents , files )
599
+ mtree = CustomTree (branch , revid , parents , files )
599
600
changes = mtree .iter_changes ()
600
601
601
- repo .lock_write ()
602
+ branch .lock_write ()
602
603
try :
603
- builder = repo .get_commit_builder (parents , None , date , tz , committer , props , revid )
604
+ builder = branch .get_commit_builder (parents , None , date , tz , committer , props , revid )
604
605
try :
605
606
list (builder .record_iter_changes (mtree , mtree .last_revision (), changes ))
606
607
builder .finish_inventory ()
@@ -609,7 +610,7 @@ def parse_commit(parser):
609
610
builder .abort ()
610
611
raise
611
612
finally :
612
- repo .unlock ()
613
+ branch .unlock ()
613
614
614
615
parsed_refs [ref ] = revid
615
616
marks .new_mark (revid , commit_mark )
@@ -653,20 +654,20 @@ def do_export(parser):
653
654
else :
654
655
die ('unhandled export command: %s' % line )
655
656
656
- repo = parser .repo
657
+ branch = parser .repo
657
658
658
659
for ref , revid in parsed_refs .iteritems ():
659
660
if ref == 'refs/heads/master' :
660
- repo .generate_revision_history (revid , marks .get_tip ('master' ))
661
+ branch .generate_revision_history (revid , marks .get_tip ('master' ))
661
662
if peer :
662
663
try :
663
- repo .push (peer , stop_revision = revid )
664
+ branch .push (peer , stop_revision = revid )
664
665
except bzrlib .errors .DivergedBranches :
665
666
print "error %s non-fast forward" % ref
666
667
continue
667
668
668
669
try :
669
- wt = repo .bzrdir .open_workingtree ()
670
+ wt = branch .bzrdir .open_workingtree ()
670
671
wt .update ()
671
672
except bzrlib .errors .NoWorkingTree :
672
673
pass
0 commit comments