mercurial/obsutil.py
changeset 34847 e27f1f04c2cf
parent 34423 2fd06499dc8e
child 34850 62a4ccf9784a
equal deleted inserted replaced
34846:f05a6e015ecc 34847:e27f1f04c2cf
   781     markersmeta = [dict(m[3]) for m in markers]
   781     markersmeta = [dict(m[3]) for m in markers]
   782     operations = set(meta.get('operation') for meta in markersmeta
   782     operations = set(meta.get('operation') for meta in markersmeta
   783                      if meta.get('operation'))
   783                      if meta.get('operation'))
   784 
   784 
   785     return sorted(operations)
   785     return sorted(operations)
       
   786 
       
   787 def obsfateprinter(successors, markers, ui):
       
   788     """ Build a obsfate string for a single successorset using all obsfate
       
   789     related function defined in obsutil
       
   790     """
       
   791     line = []
       
   792 
       
   793     # Verb
       
   794     line.append(successorsetverb(successors))
       
   795 
       
   796     # Operations
       
   797     operations = markersoperations(markers)
       
   798     if operations:
       
   799         line.append(" using %s" % ", ".join(operations))
       
   800 
       
   801     # Successors
       
   802     if successors:
       
   803         fmtsuccessors = [successors.joinfmt(succ) for succ in successors]
       
   804         line.append(" as %s" % ", ".join(fmtsuccessors))
       
   805 
       
   806     # Users
       
   807     users = markersusers(markers)
       
   808 
       
   809     if users:
       
   810         line.append(" by %s" % ", ".join(users))
       
   811 
       
   812     # Date
       
   813     dates = markersdates(markers)
       
   814 
       
   815     min_date = min(dates)
       
   816     max_date = max(dates)
       
   817 
       
   818     if min_date == max_date:
       
   819         fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
       
   820         line.append(" (at %s)" % fmtmin_date)
       
   821     else:
       
   822         fmtmin_date = util.datestr(min_date, '%Y-%m-%d %H:%M %1%2')
       
   823         fmtmax_date = util.datestr(max_date, '%Y-%m-%d %H:%M %1%2')
       
   824         line.append(" (between %s and %s)" % (fmtmin_date, fmtmax_date))
       
   825 
       
   826     return "".join(line)