Mercurial > hg
comparison hgext/automv.py @ 28151:74e3d634a30e
automv: do not release lock between marking files and the actual commit
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Mon, 15 Feb 2016 17:16:07 +0000 |
parents | 7a984cece04a |
children | 5ec1ce8fdf0a |
comparison
equal
deleted
inserted
replaced
28150:7a984cece04a | 28151:74e3d634a30e |
---|---|
31 ('', 'no-automv', None, | 31 ('', 'no-automv', None, |
32 _('disable automatic file move detection'))) | 32 _('disable automatic file move detection'))) |
33 | 33 |
34 def mvcheck(orig, ui, repo, *pats, **opts): | 34 def mvcheck(orig, ui, repo, *pats, **opts): |
35 """Hook to check for moves at commit time""" | 35 """Hook to check for moves at commit time""" |
36 renames = None | |
36 disabled = opts.pop('no_automv', False) | 37 disabled = opts.pop('no_automv', False) |
37 if not disabled: | 38 if not disabled: |
38 threshold = float(ui.config('automv', 'similarity', '1.00')) | 39 threshold = float(ui.config('automv', 'similarity', '1.00')) |
39 if threshold > 0: | 40 if threshold > 0: |
40 match = scmutil.match(repo[None], pats, opts) | 41 match = scmutil.match(repo[None], pats, opts) |
41 added, removed = _interestingfiles(repo, match) | 42 added, removed = _interestingfiles(repo, match) |
42 renames = _findrenames(repo, match, added, removed, threshold) | 43 renames = _findrenames(repo, match, added, removed, threshold) |
44 | |
45 with repo.wlock(): | |
46 if renames is not None: | |
43 scmutil._markchanges(repo, (), (), renames) | 47 scmutil._markchanges(repo, (), (), renames) |
44 | 48 return orig(ui, repo, *pats, **opts) |
45 return orig(ui, repo, *pats, **opts) | |
46 | 49 |
47 def _interestingfiles(repo, matcher): | 50 def _interestingfiles(repo, matcher): |
48 """Find what files were added or removed in this commit. | 51 """Find what files were added or removed in this commit. |
49 | 52 |
50 Returns a tuple of two lists: (added, removed). Only files not *already* | 53 Returns a tuple of two lists: (added, removed). Only files not *already* |