2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2019-05-28 13:12:27 +03:00
|
|
|
$ setconfig extensions.treemanifest=!
|
2018-01-23 23:09:16 +03:00
|
|
|
$ . helpers-usechg.sh
|
|
|
|
|
2010-09-27 01:48:57 +04:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> convert=
|
|
|
|
> [convert]
|
|
|
|
> hg.saverev=False
|
|
|
|
> EOF
|
|
|
|
$ hg init orig
|
|
|
|
$ cd orig
|
|
|
|
$ echo foo > foo
|
|
|
|
$ echo bar > bar
|
|
|
|
$ hg ci -qAm 'add foo bar' -d '0 0'
|
|
|
|
$ echo >> foo
|
|
|
|
$ hg ci -m 'change foo' -d '1 0'
|
|
|
|
$ hg up -qC 0
|
|
|
|
$ hg copy --after --force foo bar
|
|
|
|
$ hg copy foo baz
|
|
|
|
$ hg ci -m 'make bar and baz copies of foo' -d '2 0'
|
templater: don't overwrite the keyword mapping in runsymbol() (issue4362)
This keyword remapping was introduced in 236440938a03 as part of converting
generator based iterators into list based iterators, mentioning "undesired
behavior in template" when a generator is exhausted, but doesn't say what and
introduces no tests.
The problem with the remapping was that it corrupted the output for keywords
like 'extras', 'file_copies' and 'file_copies_switch' in templates such as:
$ hg log -r 82a4f5557c6b --template "{file_copies % ' File: {file_copy}\n'}"
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
File: mercurial/changelog.py (mercurial/hg.py)
What was happening was that in the first call to runtemplate() inside runmap(),
'lm' mapped the keyword (e.g. file_copies) to the appropriate showxxx() method.
On each subsequent call to runtemplate() in that loop however, the keyword was
mapped to a list of the first item's pieces, e.g.:
'file_copy': ['mercurial/changelog.py', ' (', 'mercurial/hg.py', ')']
Therefore, the dict for the second and any subsequent items were not processed
through the corresponding showxxx() method, and the first item's data was
reused.
The 'extras' keyword regressed in 56b014c52204, and 'file_copies' regressed in
4e182fb53989 for other reasons. The common thread of things fixed by this seems
to be when a list of dicts are passed to the templatekw._hybrid class.
2014-11-03 20:08:03 +03:00
|
|
|
|
|
|
|
Test that template can print all file copies (issue4362)
|
|
|
|
$ hg log -r . --template "{file_copies % ' File: {file_copy}\n'}"
|
|
|
|
File: bar (foo)
|
|
|
|
File: baz (foo)
|
|
|
|
|
2011-04-04 02:05:41 +04:00
|
|
|
$ hg bookmark premerge1
|
2012-05-13 13:55:42 +04:00
|
|
|
$ hg merge -r 1
|
2010-09-27 01:48:57 +04:00
|
|
|
merging baz and foo to baz
|
|
|
|
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m 'merge local copy' -d '3 0'
|
|
|
|
$ hg up -C 1
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
2014-05-14 23:49:55 +04:00
|
|
|
(leaving bookmark premerge1)
|
2011-04-04 02:05:41 +04:00
|
|
|
$ hg bookmark premerge2
|
2010-09-27 01:48:57 +04:00
|
|
|
$ hg merge 2
|
|
|
|
merging foo and baz to baz
|
|
|
|
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m 'merge remote copy' -d '4 0'
|
2015-05-27 22:28:29 +03:00
|
|
|
|
2012-06-10 16:14:05 +04:00
|
|
|
#if execbit
|
2010-09-27 01:48:57 +04:00
|
|
|
$ chmod +x baz
|
2012-06-10 16:14:05 +04:00
|
|
|
#else
|
|
|
|
$ echo some other change to make sure we get a rev 5 > baz
|
|
|
|
#endif
|
2010-09-27 01:48:57 +04:00
|
|
|
$ hg ci -m 'mark baz executable' -d '5 0'
|
|
|
|
$ cd ..
|
|
|
|
$ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
|
|
|
|
initializing destination new repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
2019-12-18 02:01:37 +03:00
|
|
|
5 add foo bar
|
|
|
|
4 change foo
|
|
|
|
3 make bar and baz copies of foo
|
|
|
|
2 merge local copy
|
|
|
|
1 merge remote copy
|
2011-04-21 01:15:18 +04:00
|
|
|
0 mark baz executable
|
2011-04-04 02:05:41 +04:00
|
|
|
updating bookmarks
|
2010-09-27 01:48:57 +04:00
|
|
|
$ cd new
|
|
|
|
$ hg out ../orig
|
|
|
|
comparing with ../orig
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
2012-06-10 16:14:05 +04:00
|
|
|
#if execbit
|
2011-04-04 02:05:41 +04:00
|
|
|
$ hg bookmarks
|
|
|
|
premerge1 3:973ef48a98a4
|
2019-12-18 02:01:37 +03:00
|
|
|
premerge2 5:13d9b87cf8f8
|
2012-06-10 16:14:05 +04:00
|
|
|
#else
|
|
|
|
Different hash because no x bit
|
|
|
|
$ hg bookmarks
|
|
|
|
premerge1 3:973ef48a98a4
|
2019-12-18 02:01:37 +03:00
|
|
|
premerge2 5:13d9b87cf8f8
|
2012-06-10 16:14:05 +04:00
|
|
|
#endif
|
2015-06-29 23:39:05 +03:00
|
|
|
|
|
|
|
Test that redoing a convert results in an identical graph
|
|
|
|
$ cd ../
|
|
|
|
$ rm new/.hg/shamap
|
|
|
|
$ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
2019-12-18 02:01:37 +03:00
|
|
|
5 add foo bar
|
|
|
|
4 change foo
|
|
|
|
3 make bar and baz copies of foo
|
|
|
|
2 merge local copy
|
|
|
|
1 merge remote copy
|
2015-06-29 23:39:05 +03:00
|
|
|
0 mark baz executable
|
|
|
|
updating bookmarks
|
|
|
|
$ hg -R new log -G -T '{rev} {desc}'
|
2019-12-18 02:01:37 +03:00
|
|
|
o 5 mark baz executable
|
2015-06-29 23:39:05 +03:00
|
|
|
|
|
|
|
|
o 4 merge remote copy
|
|
|
|
|\
|
|
|
|
+---o 3 merge local copy
|
|
|
|
| |/
|
|
|
|
| o 2 make bar and baz copies of foo
|
|
|
|
| |
|
|
|
|
o | 1 change foo
|
|
|
|
|/
|
|
|
|
o 0 add foo bar
|
|
|
|
|
2010-09-27 01:48:57 +04:00
|
|
|
|
|
|
|
check shamap LF and CRLF handling
|
|
|
|
|
|
|
|
$ cat > rewrite.py <<EOF
|
|
|
|
> import sys
|
|
|
|
> # Interlace LF and CRLF
|
|
|
|
> lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n'))
|
|
|
|
> for i, l in enumerate(file(sys.argv[1]))]
|
|
|
|
> file(sys.argv[1], 'wb').write(''.join(lines))
|
|
|
|
> EOF
|
2017-06-20 16:45:02 +03:00
|
|
|
$ $PYTHON rewrite.py new/.hg/shamap
|
2010-09-27 01:48:57 +04:00
|
|
|
$ cd orig
|
|
|
|
$ hg up -qC 1
|
|
|
|
$ echo foo >> foo
|
|
|
|
$ hg ci -qm 'change foo again'
|
|
|
|
$ hg up -qC 2
|
|
|
|
$ echo foo >> foo
|
|
|
|
$ hg ci -qm 'change foo again again'
|
|
|
|
$ cd ..
|
|
|
|
$ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
1 change foo again again
|
|
|
|
0 change foo again
|
2011-04-04 02:05:41 +04:00
|
|
|
updating bookmarks
|
2010-09-27 01:48:57 +04:00
|
|
|
|
|
|
|
init broken repository
|
|
|
|
|
|
|
|
$ hg init broken
|
|
|
|
$ cd broken
|
|
|
|
$ echo a >> a
|
|
|
|
$ echo b >> b
|
|
|
|
$ hg ci -qAm init
|
|
|
|
$ echo a >> a
|
|
|
|
$ echo b >> b
|
|
|
|
$ hg copy b c
|
|
|
|
$ hg ci -qAm changeall
|
|
|
|
$ hg up -qC 0
|
|
|
|
$ echo bc >> b
|
|
|
|
$ hg ci -m changebagain
|
|
|
|
$ HGMERGE=internal:local hg -q merge
|
|
|
|
$ hg ci -m merge
|
|
|
|
$ hg mv b d
|
|
|
|
$ hg ci -m moveb
|
|
|
|
|
|
|
|
break it
|
|
|
|
|
|
|
|
$ rm .hg/store/data/b.*
|
|
|
|
$ cd ..
|
|
|
|
$ hg --config convert.hg.ignoreerrors=True convert broken fixed
|
|
|
|
initializing destination fixed repository
|
|
|
|
scanning source...
|
|
|
|
sorting...
|
|
|
|
converting...
|
|
|
|
4 init
|
|
|
|
ignoring: data/b.i@1e88685f5dde: no match found
|
|
|
|
3 changeall
|
|
|
|
2 changebagain
|
|
|
|
1 merge
|
|
|
|
0 moveb
|
|
|
|
$ hg -R fixed verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
|
|
|
3 files, 5 changesets, 5 total revisions
|
|
|
|
|
|
|
|
manifest -r 0
|
|
|
|
|
|
|
|
$ hg -R fixed manifest -r 0
|
|
|
|
a
|
|
|
|
|
|
|
|
manifest -r tip
|
|
|
|
|
|
|
|
$ hg -R fixed manifest -r tip
|
|
|
|
a
|
|
|
|
c
|
|
|
|
d
|