##// END OF EJS Templates
perf: use a formatter for output...
perf: use a formatter for output We use a `formatter` object in the perf extensions. This allow the use of formatted output like json. To avoid adding logic to create a formatter and pass it around to the timer function in every command, we add a `gettimer` function in charge of returning a `timer` function as simple as before but embedding an appropriate formatter. This new `gettimer` function also return the formatter as it needs to be explicitly closed at the end of the command. example output: $ hg --config ui.formatjson=True perfvolatilesets visible obsolete [ { "comb": 0.02, "count": 126, "sys": 0.0, "title": "obsolete", "user": 0.02, "wall": 0.0199398994446 }, { "comb": 0.02, "count": 117, "sys": 0.0, "title": "visible", "user": 0.02, "wall": 0.0250301361084 } ]

File last commit:

r18373:687ed69f default
r23171:8afae1d5 default
Show More
test-convert-clonebranches.t
88 lines | 2.2 KiB | text/troff | Tads3Lexer
/ tests / test-convert-clonebranches.t
$ echo "[extensions]" >> $HGRCPATH
$ echo "convert = " >> $HGRCPATH
$ echo "[convert]" >> $HGRCPATH
$ echo "hg.tagsbranch=0" >> $HGRCPATH
$ 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
> import sys, re
>
> 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
(branches are permanent and global, did you want a bookmark?)
$ echo a > file1
$ hg ci -qAm c1
$ hg up -qC mergeab
$ hg branch branch2
marked working directory as branch branch2
(branches are permanent and global, did you want a bookmark?)
$ 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
(branches are permanent and global, did you want a bookmark?)
$ 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