43
42
import bzrlib.branch
44
43
import bzrlib.delta
46
44
import bzrlib.errors
47
import bzrlib.lru_cache
48
import bzrlib.progress
49
import bzrlib.revision
50
import bzrlib.textfile
54
# bzrlib's UIFactory is not thread-safe
55
uihack = threading.local()
58
class ThreadSafeUIFactory (bzrlib.ui.SilentUIFactory):
60
def nested_progress_bar(self):
61
if getattr(uihack, '_progress_bar_stack', None) is None:
62
pbs = bzrlib.progress.ProgressBarStack(
63
klass=bzrlib.progress.DummyProgress)
64
uihack._progress_bar_stack = pbs
65
return uihack._progress_bar_stack.get_nested()
67
bzrlib.ui.ui_factory = ThreadSafeUIFactory()
69
47
def is_branch(folder):
649
627
Given a bzrlib Revision, return a processed "change" for use in
652
parents = [util.Container(revid=r,
653
revno=self.get_revno(r)) for r in revision.parent_ids]
655
630
message, short_message = clean_message(revision.message)
658
authors = revision.get_apparent_authors()
659
except AttributeError:
660
authors = [revision.get_apparent_author()]
632
tags = self._branch.tags.get_reverse_tag_dict()
635
if tags.has_key(revision.revision_id):
636
revtags = ', '.join(tags[revision.revision_id])
663
639
'revid': revision.revision_id,
664
640
'date': datetime.datetime.fromtimestamp(revision.timestamp),
665
641
'utc_date': datetime.datetime.utcfromtimestamp(revision.timestamp),
642
'authors': revision.get_apparent_authors(),
667
643
'branch_nick': revision.properties.get('branch-nick', None),
668
644
'short_comment': short_message,
669
645
'comment': revision.message,
670
646
'comment_clean': [util.html_clean(s) for s in message],
671
647
'parents': revision.parent_ids,
672
648
'bugs': [bug.split()[0] for bug in revision.properties.get('bugs', '').splitlines()],
674
651
return util.Container(entry)
676
653
def get_file_changes_uncached(self, entry):
677
repo = self._branch.repository
678
654
if entry.parents:
679
655
old_revid = entry.parents[0].revid