##// END OF EJS Templates
largefiles: access to specific fields only if largefiles enabled (issue4547)...
largefiles: access to specific fields only if largefiles enabled (issue4547) Even if largefiles extension is enabled in a repository, "repo" object, which isn't "largefiles.reposetup()"-ed, is passed to overridden functions in the cases below unexpectedly, because extensions are enabled for each repositories strictly. (1) clone without -U: (2) pull with -U: (3) pull with --rebase: combination of "enabled@src", "disabled@dst" and "not-required@src" cause this situation. largefiles requirement @src @dst @src result -------- -------- --------------- -------------------- enabled disabled not-required aborted unexpectedly required requirement error (intentional) -------- -------- --------------- -------------------- enabled enabled * success -------- -------- --------------- -------------------- disabled enabled * success (only for "pull") -------- -------- --------------- -------------------- disabled disabled not-required success required requirement error (intentional) -------- -------- --------------- -------------------- (4) update/revert with a subrepo disabling largefiles In these cases, overridden functions cause accessing to largefiles specific fields of not "largefiles.reposetup()"-ed "repo" object, and execution is aborted. - (1), (2), (4) cause accessing to "_lfstatuswriters" in "getstatuswriter()" invoked via "updatelfiles()" - (3) causes accessing to "_lfcommithooks" in "overriderebase()" For safe accessing to these fields, this patch examines whether passed "repo" object is "largefiles.reposetup()"-ed or not before accessing to them. This patch chooses examining existence of newly introduced "_largefilesenabled" instead of "_lfcommithooks" and "_lfstatuswriters" directly, because the former is better name for the generic "largefiles is enabled in this repo" mark than the latter. In the future, all other overridden functions should avoid largefiles specific processing for efficiency, and "_largefilesenabled" is better also for such purpose. BTW, "lfstatus" can't be used for such purpose, because some code paths set it forcibly regardless of existence of it in specified "repo" object.

File last commit:

r23167:a3c2d921 stable
r24158:d414c28d stable
Show More
test-convert-hg-source.t
156 lines | 3.6 KiB | text/troff | Tads3Lexer
/ tests / test-convert-hg-source.t
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ 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'
created new head
Matt Harbison
templater: don't overwrite the keyword mapping in runsymbol() (issue4362)...
r23167
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)
Edouard Gomez
convert: add hg source bookmark test
r13866 $ hg bookmark premerge1
David Soria Parra
merge: respect bookmarks during merge...
r16708 $ hg merge -r 1
Matt Mackall
tests: unify test-convert-hg-source
r12526 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
Siddharth Agarwal
update: when deactivating a bookmark, print a message...
r21404 (leaving bookmark premerge1)
Edouard Gomez
convert: add hg source bookmark test
r13866 $ hg bookmark premerge2
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ 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'
created new head
Mads Kiilerich
tests: convert some 'hghave execbit' to #if...
r16899 #if execbit
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ chmod +x baz
Mads Kiilerich
tests: convert some 'hghave execbit' to #if...
r16899 #else
$ echo some other change to make sure we get a rev 5 > baz
#endif
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ 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...
Patrick Mezard
convert: make filemap prune useless branch closing revs (issue2774)...
r13968 5 add foo bar
4 change foo
3 make bar and baz copies of foo
2 merge local copy
1 merge remote copy
0 mark baz executable
Edouard Gomez
convert: add hg source bookmark test
r13866 updating bookmarks
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ cd new
$ hg out ../orig
comparing with ../orig
searching for changes
no changes found
[1]
Mads Kiilerich
tests: convert some 'hghave execbit' to #if...
r16899 #if execbit
Edouard Gomez
convert: add hg source bookmark test
r13866 $ hg bookmarks
premerge1 3:973ef48a98a4
Patrick Mezard
merge with stable
r13969 premerge2 5:13d9b87cf8f8
Mads Kiilerich
tests: convert some 'hghave execbit' to #if...
r16899 #else
Different hash because no x bit
$ hg bookmarks
premerge1 3:973ef48a98a4
premerge2 5:df0779bcf33c
#endif
Matt Mackall
tests: unify test-convert-hg-source
r12526 $ cd ..
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
$ python rewrite.py new/.hg/shamap
$ 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
Edouard Gomez
convert: add hg source bookmark test
r13866 updating bookmarks
Matt Mackall
tests: unify test-convert-hg-source
r12526
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
created new head
$ 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