[PATCH 2 of 5 V2] revert: add documentation in the dispatch table

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Sep 8 09:58:19 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1409356138 -7200
#      Sat Aug 30 01:48:58 2014 +0200
# Node ID fee9bbe045a80ce0706dd86442ab5dc16a07a80b
# Parent  cd3e613dc2e306ab5ac2486d67ca5bfb87225147
revert: add documentation in the dispatch table

More grained sets are coming so documenting the existing ones will help.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2516,16 +2516,26 @@ def revert(ui, repo, ctx, parents, *pats
         disptable = (
             # dispatch table:
             #   file state
             #   action
             #   make backup
+
+            ## Sets that results that will change file on disk
+            # Modified compared to target, no local change
             (modified,   actions['revert'],   discard),
+            # Modified compared to target, local change
             (dsmodified, actions['revert'],   backup),
+            # Added since target
             (dsadded,    actions['remove'],   backup),
+            # Removed since  target, before working copy parent
             (removed,    actions['add'],      backup),
+            # Removed since targe, marked as such in working copy parent
             (dsremoved,  actions['undelete'], backup),
+            ## the following sets does not result in any file changes
+            # File with no modification
             (clean,      actions['noop'],     discard),
+            # Existing file, not tracked anywhere
             (unknown,    actions['unknown'],  discard),
             )
 
         needdata = ('revert', 'add', 'remove', 'undelete')
         _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])


More information about the Mercurial-devel mailing list