Patchwork D933: scmutil: add a new function to show changes after a command

login
register
mail settings
Submitter phabricator
Date Oct. 4, 2017, 3:13 p.m.
Message ID <ca2f60a4c88ec5472f939bdb2c428709@localhost.localdomain>
Download mbox | patch
Permalink /patch/24501/
State Not Applicable
Headers show

Comments

phabricator - Oct. 4, 2017, 3:13 p.m.
pulkit updated this revision to Diff 2418.
pulkit edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D933?vs=2414&id=2418

REVISION DETAIL
  https://phab.mercurial-scm.org/D933

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: dlax, quark, yuja, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -685,6 +685,14 @@ 
             if tostrip:
                 repair.delayedstrip(repo.ui, repo, tostrip, operation)
 
+def showchanges(replacements, fm):
+    """ output the hash changes using formatter instance which is passed.
+    """
+    nodesdict = {short(pred): [short(s) for s in succs] for pred, succs in
+                                                    replacements.iteritems()}
+    fm.write('hashchanges', '%s\n',
+                        fm.formatdict(nodesdict, fmt='%r --> %r', sep='\n'))
+
 def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
     if opts is None:
         opts = {}