mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
effa0da8de
Summary: The helper could be used in individual tests to enable chg if chg exists. This allows us to have more precise control on what tests to use chg instead of using a global flag in run-tests.py. This makes certain tests containing many hg commands much faster. For example, `test-revset.t` took 99 seconds before: % ./run-tests.py test-revset.t --time . # Ran 1 tests, 0 skipped, 0 failed. # Producing time report start end cuser csys real Test 0.000 99.990 86.410 12.000 99.990 test-revset.t And 10 seconds after: % ./run-tests.py test-revset.t --time . # Ran 1 tests, 0 skipped, 0 failed. # Producing time report start end cuser csys real Test 0.000 10.080 0.380 0.130 10.080 test-revset.t Also enable it for some other tests. Note the whitelist is not complete. We probably want to whitelist more tests in the future. The feature could be opted out by deleting `contrib/chg/chg`. Reviewed By: phillco Differential Revision: D6767036 fbshipit-source-id: 8220cf408aa198d5d8e2ca5127ca60e2070d3444
91 lines
2.0 KiB
Perl
91 lines
2.0 KiB
Perl
$ . helpers-usechg.sh
|
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
> [extensions]
|
|
> convert =
|
|
> [convert]
|
|
> hg.tagsbranch = 0
|
|
> EOF
|
|
$ hg init source
|
|
$ cd source
|
|
$ echo a > a
|
|
$ hg ci -qAm adda
|
|
|
|
Add a merge with one parent in the same branch
|
|
|
|
$ echo a >> a
|
|
$ hg ci -qAm changea
|
|
$ hg up -qC 0
|
|
$ hg branch branch0
|
|
marked working directory as branch branch0
|
|
(branches are permanent and global, did you want a bookmark?)
|
|
$ echo b > b
|
|
$ hg ci -qAm addb
|
|
$ hg up -qC
|
|
$ hg merge default
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(branch merge, don't forget to commit)
|
|
$ hg ci -qm mergeab
|
|
$ hg tag -ql mergeab
|
|
$ cd ..
|
|
|
|
Miss perl... sometimes
|
|
|
|
$ cat > filter.py <<EOF
|
|
> from __future__ import absolute_import
|
|
> import re
|
|
> import sys
|
|
>
|
|
> r = re.compile(r'^(?:\d+|pulling from)')
|
|
> sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
|
|
> EOF
|
|
|
|
convert
|
|
|
|
$ hg convert -v --config convert.hg.clonebranches=1 source dest |
|
|
> $PYTHON filter.py
|
|
3 adda
|
|
2 changea
|
|
1 addb
|
|
pulling from default into branch0
|
|
1 changesets found
|
|
0 mergeab
|
|
pulling from default into branch0
|
|
1 changesets found
|
|
|
|
Add a merge with both parents and child in different branches
|
|
|
|
$ cd source
|
|
$ hg branch branch1
|
|
marked working directory as branch branch1
|
|
$ echo a > file1
|
|
$ hg ci -qAm c1
|
|
$ hg up -qC mergeab
|
|
$ hg branch branch2
|
|
marked working directory as branch branch2
|
|
$ echo a > file2
|
|
$ hg ci -qAm c2
|
|
$ hg merge branch1
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(branch merge, don't forget to commit)
|
|
$ hg branch branch3
|
|
marked working directory as branch branch3
|
|
$ hg ci -qAm c3
|
|
$ cd ..
|
|
|
|
incremental conversion
|
|
|
|
$ hg convert -v --config convert.hg.clonebranches=1 source dest |
|
|
> $PYTHON filter.py
|
|
2 c1
|
|
pulling from branch0 into branch1
|
|
4 changesets found
|
|
1 c2
|
|
pulling from branch0 into branch2
|
|
4 changesets found
|
|
0 c3
|
|
pulling from branch1 into branch3
|
|
5 changesets found
|
|
pulling from branch2 into branch3
|
|
1 changesets found
|