[PATCH follow-up] obsfate: fix obsfate_printer with empty date list

Boris Feld boris.feld at octobus.net
Wed Oct 18 14:35:02 UTC 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1508333931 -7200
#      Wed Oct 18 15:38:51 2017 +0200
# Node ID 328ec528162a716ef61877de1982860b67973afa
# Parent  962f7df21a73f044d171fee9c237d0c5062ae317
# EXP-Topic elite-mink
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 328ec528162a
obsfate: fix obsfate_printer with empty date list

When the list of dates is empty, `min` and `max` would raises a ValueError.
Protect against this case by checking that the date list is not empty.

I didn't add a test because I couldn't find a reproducing test case.

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -822,7 +822,7 @@
     # Date
     dates = markersdates(markers)
 
-    if verbose:
+    if dates and verbose:
         min_date = min(dates)
         max_date = max(dates)
 


More information about the Mercurial-devel mailing list