comparison mercurial/commands.py @ 34682:7e3001b74ab3

tersestatus: re-implement the functionality to terse the status The previous terse status implementation was hacking around os.listdir() and was flaky. There have been a lot of instances of mercurial buildbots failing and google's internal builds failing because of the hacky implementation of terse status. Even though I wrote the last implementation but it was hard for me to find the reason for the flake. The new implementation can be slower than the old one but is clean and easy to understand. In this we create a node object for each directory and create a tree like structure starting from the root of the working copy. While building the tree like structure we store some information on the nodes which will be helpful for deciding later whether we can terse the dir or not. Once the whole tree is build we traverse and built the list of files for each status with required tersing. There is no behaviour change as the old test, test-status-terse.t passes with the new implementation. Differential Revision: https://phab.mercurial-scm.org/D985
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 06 Oct 2017 20:54:23 +0530
parents 6ce2d81968aa
children 84c6b9384d6a
comparison
equal deleted inserted replaced
34681:4dc8a2ee0f4f 34682:7e3001b74ab3
4803 show = states[:4] 4803 show = states[:4]
4804 else: 4804 else:
4805 show = states[:5] 4805 show = states[:5]
4806 4806
4807 m = scmutil.match(repo[node2], pats, opts) 4807 m = scmutil.match(repo[node2], pats, opts)
4808 stat = repo.status(node1, node2, m,
4809 'ignored' in show, 'clean' in show, 'unknown' in show,
4810 opts.get('subrepos'))
4811 if terse: 4808 if terse:
4812 stat = cmdutil.tersestatus(repo.root, stat, terse, 4809 # we need to compute clean and unknown to terse
4813 repo.dirstate._ignore, opts.get('ignored')) 4810 stat = repo.status(node1, node2, m,
4811 'ignored' in show or 'i' in terse,
4812 True, True, opts.get('subrepos'))
4813
4814 stat = cmdutil.tersedir(stat, terse)
4815 else:
4816 stat = repo.status(node1, node2, m,
4817 'ignored' in show, 'clean' in show,
4818 'unknown' in show, opts.get('subrepos'))
4819
4814 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat) 4820 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat)
4815 4821
4816 if (opts.get('all') or opts.get('copies') 4822 if (opts.get('all') or opts.get('copies')
4817 or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'): 4823 or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
4818 copy = copies.pathcopies(repo[node1], repo[node2], m) 4824 copy = copies.pathcopies(repo[node1], repo[node2], m)