Patchwork [2,of,5] revert: add documentation in the dispatch table

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 4, 2014, 6:33 p.m.
Message ID <fcf5369a3f73b708c628.1409855600@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5700/
State Superseded
Headers show

Comments

Pierre-Yves David - Sept. 4, 2014, 6:33 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1409356138 -7200
#      Sat Aug 30 01:48:58 2014 +0200
# Node ID fcf5369a3f73b708c628b0789cc4d3e0a211bc40
# Parent  b1ac8262fc4b3e58d92015ecf29edd863418b5bb
revert: add documentation in the dispatch table

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

Patch

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(ctx, *[actions[name][0] for name in needdata])