@@ -257,7 +257,8 @@ def export_branch(branch, name):
257257 tip = marks .get_tip (name )
258258
259259 repo = branch .repository
260- repo .lock_read ()
260+
261+ branch .lock_read ()
261262 revs = branch .iter_merge_sorted_revisions (None , tip , 'exclude' , 'forward' )
262263 count = 0
263264
@@ -325,7 +326,7 @@ def export_branch(branch, name):
325326 print "progress revision %s (%d/%d)" % (revid , count , len (revs ))
326327 print "#############################################################"
327328
328- repo .unlock ()
329+ branch .unlock ()
329330
330331 revid = branch .last_revision ()
331332
@@ -383,21 +384,21 @@ def parse_blob(parser):
383384
384385class CustomTree ():
385386
386- def __init__ (self , repo , revid , parents , files ):
387+ def __init__ (self , branch , revid , parents , files ):
387388 global files_cache
388389
389390 self .updates = {}
390- self .branch = repo
391+ self .branch = branch
391392
392393 def copy_tree (revid ):
393394 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 )
396397 try :
397398 for path , entry in tree .iter_entries_by_dir ():
398399 files [path ] = [entry .file_id , None ]
399400 finally :
400- repo .unlock ()
401+ branch .unlock ()
401402 return files
402403
403404 if len (parents ) == 0 :
@@ -587,20 +588,20 @@ def parse_commit(parser):
587588 path = c_style_unescape (path ).decode ('utf-8' )
588589 files [path ] = f
589590
590- repo = parser .repo
591+ branch = parser .repo
591592
592593 committer , date , tz = committer
593594 parents = [str (mark_to_rev (p )) for p in parents ]
594595 revid = bzrlib .generate_ids .gen_revision_id (committer , date )
595596 props = {}
596- props ['branch-nick' ] = repo .nick
597+ props ['branch-nick' ] = branch .nick
597598
598- mtree = CustomTree (repo , revid , parents , files )
599+ mtree = CustomTree (branch , revid , parents , files )
599600 changes = mtree .iter_changes ()
600601
601- repo .lock_write ()
602+ branch .lock_write ()
602603 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 )
604605 try :
605606 list (builder .record_iter_changes (mtree , mtree .last_revision (), changes ))
606607 builder .finish_inventory ()
@@ -609,7 +610,7 @@ def parse_commit(parser):
609610 builder .abort ()
610611 raise
611612 finally :
612- repo .unlock ()
613+ branch .unlock ()
613614
614615 parsed_refs [ref ] = revid
615616 marks .new_mark (revid , commit_mark )
@@ -653,20 +654,20 @@ def do_export(parser):
653654 else :
654655 die ('unhandled export command: %s' % line )
655656
656- repo = parser .repo
657+ branch = parser .repo
657658
658659 for ref , revid in parsed_refs .iteritems ():
659660 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' ))
661662 if peer :
662663 try :
663- repo .push (peer , stop_revision = revid )
664+ branch .push (peer , stop_revision = revid )
664665 except bzrlib .errors .DivergedBranches :
665666 print "error %s non-fast forward" % ref
666667 continue
667668
668669 try :
669- wt = repo .bzrdir .open_workingtree ()
670+ wt = branch .bzrdir .open_workingtree ()
670671 wt .update ()
671672 except bzrlib .errors .NoWorkingTree :
672673 pass
0 commit comments