[PATCH 4 of 7 clowncopter] automv: improve function docstrings

Martijn Pieters mj at zopatista.com
Mon Feb 15 12:24:58 EST 2016


# HG changeset patch
# User Martijn Pieters <mjpieters at fb.com>
# Date 1455555693 0
#      Mon Feb 15 17:01:33 2016 +0000
# Node ID df7847e855528ed4702757dc89095ad8a7489e5e
# Parent  491d25e6bc4aa6433e85c2d97c459d627cf05192
automv: improve function docstrings.

diff --git a/hgext/automv.py b/hgext/automv.py
--- a/hgext/automv.py
+++ b/hgext/automv.py
@@ -32,6 +32,7 @@
          _('disable automatic file move detection')))
 
 def mvcheck(orig, ui, repo, *pats, **opts):
+    """Hook to check for moves at commit time"""
     disabled = opts.pop('no_automv', False)
     if not disabled:
         threshold = float(ui.config('automv', 'similarity', '1.00'))
@@ -44,6 +45,12 @@
     return orig(ui, repo, *pats, **opts)
 
 def _interestingfiles(repo, matcher):
+    """Find what files were added or removed in this commit.
+
+    Returns a tuple of two lists: (added, removed). Only files not *already*
+    marked as moved are included in the added list.
+
+    """
     stat = repo.status(match=matcher)
     added = stat[1]
     removed = stat[2]
@@ -55,8 +62,12 @@
     return added, removed
 
 def _findrenames(repo, matcher, added, removed, similarity):
-    """Find renames from removed files of the current commit/amend files
-    to the added ones"""
+    """Find what files in added are really moved files.
+
+    Any file named in removed that is at least similarity% similar to a file
+    in added is seen as a rename.
+
+    """
     renames = {}
     if similarity > 0:
         for src, dst, score in similar.findrenames(


More information about the Mercurial-devel mailing list