Mercurial > hg
view tests/test-dirs.py @ 49510:e02dcc625171
revset: handle wdir() in `roots()`
This is already handled in `heads()`, and both are needed to determine if a set
is contiguous.
I'm guessing the `0 <= p` check was to try to filter out the null revision, but
it looks like that comes through in the corner case of a new repo with no
commits. But that was already the case, as shown by the tests.
Before (on a clone of hg):
$ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
! wall 0.059301 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
After:
$ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
! wall 0.059387 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 03 Oct 2022 17:24:52 -0400 |
parents | 6000f5b25c9b |
children |
line wrap: on
line source
import unittest import silenttestrunner from mercurial import pathutil class dirstests(unittest.TestCase): def testdirs(self): for case, want in [ (b'a/a/a', [b'a', b'a/a', b'']), (b'alpha/beta/gamma', [b'', b'alpha', b'alpha/beta']), ]: d = pathutil.dirs([]) d.addpath(case) self.assertEqual(sorted(d), sorted(want)) def testinvalid(self): with self.assertRaises(ValueError): d = pathutil.dirs([]) d.addpath(b'a//b') if __name__ == '__main__': silenttestrunner.main(__name__)