# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1499088850 -7200 # Mon Jul 03 15:34:10 2017 +0200 # Node ID 817d5a7df52dff4584ac3d9e5eef17230d2b1ae8 # Parent ae148d33f0cff729874e141d9638960da19b0232 # EXP-Topic obsfatetemplate template: show dates in obsfateprinter
Extract the dates from obsmarkers. Display them only in verbose mode and group them if we are grouping several obsmarkers. The output will be this one in case of a single obsmarker: (at 2001-04-19 04:25 +0000) And this one in case of several obsmarkers: (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000) diff -r ae148d33f0cf -r 817d5a7df52d mercurial/obsutil.py --- a/mercurial/obsutil.py Mon Jul 03 15:34:00 2017 +0200 +++ b/mercurial/obsutil.py Mon Jul 03 15:34:10 2017 +0200 @@ -576,9 +576,24 @@ return {'users': sorted(users)} +def _successorsetdates(successorset, markers): + """returns the max date and the min date of the markers list + """ + + if not markers: + return {} + + dates = [m[4] for m in markers] + + return { + 'min_date': min(dates), + 'max_date': max(dates) + } + FORMATSSETSFUNCTIONS = [ _successorsetverb, _successorsetusers, + _successorsetdates, ] def preparesuccessorset(successorset, rawmarkers): diff -r ae148d33f0cf -r 817d5a7df52d mercurial/templatekw.py --- a/mercurial/templatekw.py Mon Jul 03 15:34:00 2017 +0200 +++ b/mercurial/templatekw.py Mon Jul 03 15:34:10 2017 +0200 @@ -672,6 +672,19 @@ fmtsuccessors = map(lambda s: _formatrevnode(repo[s]), successors) line.append(" as %s" % ", ".join(fmtsuccessors)) + # Date + if verbose: + min_date = obsfateline['min_date'] + max_date = obsfateline['max_date'] + + if min_date == max_date: + fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') + line.append(" (at %s)" % fmtmin_date) + else: + fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2') + fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2') + line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date)) + return "".join(line) def _obsfateprinter(obsfate, repo, ui, prefix=""): @@ -694,6 +707,8 @@ This line will contains these information: - The list of closest successors in the log output - The users which have evolve the changeset + - The date or date range of the evolution betwwen the changeset and its + successors """ # Get the needed obsfate data diff -r ae148d33f0cf -r 817d5a7df52d tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t Mon Jul 03 15:34:00 2017 +0200 +++ b/tests/test-obsmarker-template.t Mon Jul 03 15:34:10 2017 +0200 @@ -102,7 +102,7 @@ o d004c8f274b9 | | @ 471f378eab4c - |/ Obsfate: rewritten by test1, test2 as 4:d004c8f274b9 + |/ Obsfate: rewritten by test1, test2 as 4:d004c8f274b9 (between 2001-04-19 04:25 +0000 and 2009-02-13 23:31 +0000) o ea207398892e $ hg up 'desc(A1)' --hidden @@ -125,7 +125,7 @@ o d004c8f274b9 | | @ a468dc9b3633 - |/ Obsfate: rewritten by test2 as 4:d004c8f274b9 + |/ Obsfate: rewritten by test2 as 4:d004c8f274b9 (at 2001-04-19 04:25 +0000) o ea207398892e Predecessors template should show all the predecessors as we force their display @@ -205,11 +205,11 @@ @ d004c8f274b9 | | x a468dc9b3633 - |/ Obsfate: rewritten by test2 as 4:d004c8f274b9 + |/ Obsfate: rewritten by test2 as 4:d004c8f274b9 (at 2001-04-19 04:25 +0000) | x f137d23bb3e1 | | | x 471f378eab4c - |/ Obsfate: rewritten by test1 as 3:a468dc9b3633 + |/ Obsfate: rewritten by test1 as 3:a468dc9b3633 (at 2009-02-13 23:31 +0000) o ea207398892e Test templates with splitted commit _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel