# HG changeset patch # User Martijn Pieters # Date 1455555693 0 # Node ID d356d5250ab24ea3b909e67c3e8d4e1b88486406 # Parent e8c2a60864fc165d76c5cc564b5ab4e495817c51 automv: improve function docstrings diff -r e8c2a60864fc -r d356d5250ab2 hgext/automv.py --- 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(