diff mercurial/obsolete.py @ 32327:3546a771e376

obsolete: add operation metadata to rebase/amend/histedit obsmarkers By recording what operation created the obsmarker, we can show very intuitive messages to the user in various UIs. For instance, log output could have messages like "Amended as XXX" to show why a commit is old and has an 'x' on it. @ ac28e3 durham / First commit | | o d4afe7 durham | | Second commit | | | x 8e9a5d (Amended as ac28e3) durham |/ First commit |
author Durham Goode <durham@fb.com>
date Tue, 09 May 2017 16:29:31 -0700
parents 7c3ef55dedbe
children 566cfe9cbbb9
line wrap: on
line diff
--- a/mercurial/obsolete.py	Wed May 17 22:33:15 2017 -0700
+++ b/mercurial/obsolete.py	Tue May 09 16:29:31 2017 -0700
@@ -1203,7 +1203,8 @@
     return divergent
 
 
-def createmarkers(repo, relations, flag=0, date=None, metadata=None):
+def createmarkers(repo, relations, flag=0, date=None, metadata=None,
+                  operation=None):
     """Add obsolete markers between changesets in a repo
 
     <relations> must be an iterable of (<old>, (<new>, ...)[,{metadata}])
@@ -1224,6 +1225,8 @@
         metadata = {}
     if 'user' not in metadata:
         metadata['user'] = repo.ui.username()
+    if operation:
+        metadata['operation'] = operation
     tr = repo.transaction('add-obsolescence-marker')
     try:
         markerargs = []