##// END OF EJS Templates
fsmonitor: change the distance calculation...
Eamonn Kent -
r34565:b79f5942 default
parent child Browse files
Show More
@@ -660,6 +660,14 b' class state_update(object):'
660 'watchman', 'Exception %s while running %s\n', e, cmd)
660 'watchman', 'Exception %s while running %s\n', e, cmd)
661 return False
661 return False
662
662
663 # Estimate the distance between two nodes
664 def calcdistance(repo, oldnode, newnode):
665 anc = repo.changelog.ancestor(oldnode, newnode)
666 ancrev = repo[anc].rev()
667 distance = (abs(repo[oldnode].rev() - ancrev)
668 + abs(repo[newnode].rev() - ancrev))
669 return distance
670
663 # Bracket working copy updates with calls to the watchman state-enter
671 # Bracket working copy updates with calls to the watchman state-enter
664 # and state-leave commands. This allows clients to perform more intelligent
672 # and state-leave commands. This allows clients to perform more intelligent
665 # settling during bulk file change scenarios
673 # settling during bulk file change scenarios
@@ -671,14 +679,8 b' def wrapupdate(orig, repo, node, branchm'
671 partial = True
679 partial = True
672 if matcher is None or matcher.always():
680 if matcher is None or matcher.always():
673 partial = False
681 partial = False
674 wc = repo[None]
682 distance = calcdistance(repo.unfiltered(), repo['.'].node(),
675 parents = wc.parents()
683 repo[node].node())
676 if len(parents) == 2:
677 anc = repo.changelog.ancestor(parents[0].node(), parents[1].node())
678 ancrev = repo[anc].rev()
679 distance = abs(repo[node].rev() - ancrev)
680 elif len(parents) == 1:
681 distance = abs(repo[node].rev() - parents[0].rev())
682
684
683 with state_update(repo, node, distance, partial):
685 with state_update(repo, node, distance, partial):
684 return orig(
686 return orig(
General Comments 0
You need to be logged in to leave comments. Login now