changeset 28149:d356d5250ab2

automv: improve function docstrings
author Martijn Pieters <mjpieters@fb.com>
date Mon, 15 Feb 2016 17:01:33 +0000
parents e8c2a60864fc
children 7a984cece04a
files hgext/automv.py
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/automv.py	Mon Feb 15 16:51:31 2016 +0000
+++ b/hgext/automv.py	Mon Feb 15 17:01:33 2016 +0000
@@ -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(