1024
1026
tend = time.time()
1025
1027
print "DEBUG: separating files and dirs =", tend - tstart
1030
""" Cache based on revision history. """
1031
def __init__(self, history):
1032
self._history = history
1034
def _lookup_revision(self, revid):
1035
print "DEBUG: looking up revision =", revid
1036
for r in self._history:
1037
if r.revision_id == revid:
1038
print "DEBUG: revision found =", r
1040
print "DEBUG: revision not found, adding it to the cache."
1041
rev = repo.get_revision(revid)
1042
self._history.append(rev)
1027
1045
repo = self.remote_branch.repository
1029
1047
tstart = time.time()
1030
revs = repo.get_revisions(self.remote_branch.revision_history())
1048
revhistory = self.remote_branch.revision_history()
1050
revs = repo.get_revisions(revhistory)
1051
cache = HistoryCache(revs)
1052
except bzrerrors.InvalidHttpResponse:
1053
# Fallback to dummy algorithm, because of LP: #115209
1054
cache = HistoryCache([])
1031
1056
tend = time.time()
1032
1057
print "DEBUG: fetching all revisions =", tend - tstart
1034
def _lookup_revision(revid):
1035
print "DEBUG: looking up revision =", revid
1037
if r.revision_id == revid:
1038
print "DEBUG: revision found =", r
1040
print "DEBUG: revision not found, adding it to the cache."
1041
rev = repo.get_revision(revid)
1045
1059
tstart = time.time()
1046
1060
for item in dirs:
1047
1061
ts = time.time()
1048
1062
if item.parent_id == self.remote_parent:
1049
rev = _lookup_revision(item.revision)
1063
rev = cache._lookup_revision(item.revision)
1050
1064
print "DEBUG: revision result =", rev
1051
1065
liststore.append([ gtk.STOCK_DIRECTORY,
1069
1083
for item in files:
1070
1084
ts = time.time()
1071
1085
if item.parent_id == self.remote_parent:
1072
rev = _lookup_revision(item.revision)
1086
rev = cache._lookup_revision(item.revision)
1073
1087
liststore.append([ gtk.STOCK_FILE,
1086
1100
print "DEBUG: processed", item.name, "in", te - ts
1087
1101
tend = time.time()
1088
1102
print "DEBUG: filling up files =", tend - tstart
1104
self.image_location_error.destroy()
1090
1106
# Columns should auto-size
1091
1107
self.treeview_right.columns_autosize()