Changeset 4b84a80c18df…
Parent c6bd6201f413…
by
Changes to 3 files · Browse files at 4b84a80c18df Showing diff from parent c6bd6201f413 Diff from another changeset...
@@ -89,3 +89,31 @@ assert_equals(set([filectxs[0], filectxs[1]]), set(palette['#ffaaaa']))
assert_equals(set([filectxs[2], filectxs[3]]), set(palette['#ffaae9']))
assert_equals(set([filectxs[4]]), set(palette['#d4aaff']))
+
+def test_makeannotatepalette_mindate_included():
+ agestep = 10 * SECS_PER_DAY
+ filectxs = [fakectx(0, 0 * agestep), fakectx(0, 1 * agestep),
+ fakectx(0, 2 * agestep), fakectx(0, 3 * agestep),
+ fakectx(0, 4 * agestep), fakectx(0, 5 * agestep),
+ fakectx(0, 6 * agestep), fakectx(0, 7 * agestep)]
+ palette = colormap.makeannotatepalette(filectxs, now=7 * agestep,
+ maxcolors=4, maxhues=4,
+ maxsaturations=255,
+ mindate=2 * agestep)
+ palfctxs = set()
+ for _color, fctxs in palette.iteritems():
+ palfctxs.update(fctxs)
+ for fctx in filectxs[2:]:
+ assert fctx in palfctxs
+
+def test_makeannotatepalette_mindate_earlier_than_rev0():
+ agestep = 50 * SECS_PER_DAY
+ filectxs = [fakectx(0, 1 * agestep), fakectx(0, 2 * agestep)]
+ palette = colormap.makeannotatepalette(filectxs, now=2 * agestep,
+ maxcolors=1, maxhues=1,
+ maxsaturations=255, mindate=0)
+ palfctxs = set()
+ for _color, fctxs in palette.iteritems():
+ palfctxs.update(fctxs)
+ for fctx in filectxs:
+ assert fctx in palfctxs
|
@@ -253,11 +253,15 @@ """Redefine line markers according to the current revs"""
curdate = self.repo[self._rev].date()[0]
+ # make sure to colorize at least 1 year
+ mindate = curdate - 365 * 24 * 60 * 60
+
self._revmarkers.clear()
filectxs = iter(fctx for fctx, _origline in self._links)
palette = colormap.makeannotatepalette(filectxs, curdate,
maxcolors=32, maxhues=8,
- maxsaturations=16)
+ maxsaturations=16,
+ mindate=mindate)
for i, (color, fctxs) in enumerate(palette.iteritems()):
self.markerDefine(QsciScintilla.Background, i)
self.setMarkerBackgroundColor(QColor(color), i)
|
Loading...