Mercurial > hg
annotate tests/test-duplicateoptions.py @ 24787:9d5c27890790
largefiles: for update -C, only update largefiles when necessary
Before, a --clean update with largefiles would use the "optimization" that it
didn't read hashes from standin files before and after the update. Instead of
trusting the content of the standin files, it would rehash all the actual
largefiles that lfdirstate reported clean and update the standins that didn't
have the expected content. It could thus in some "impossible" situations
automatically recover from some "largefile got out sync with its standin"
issues (even there apparently still were weird corner cases where it could
fail). This extra checking is similar to what core --clean intentionally do
not do, and it made update --clean unbearable slow.
Usually in core Mercurial, --clean will rely on the dirstate to find the files
it should update. (It is thus intentionally possible (when trying to trick the
system or if there should be bugs) to end up in situations where --clean not
will restore the working directory content correctly.) Checking every file when
we "know" it is ok is however not an option - that would be too slow.
Instead, trust the content of the standin files. Use the same logic for --clean
as for linear updates and trust the dirstate and that our "logic" will keep
them in sync. It is much cheaper to just rehash the largefiles reported dirty
by a status walk and read all standins than to hash largefiles.
Most of the changes are just a change of indentation now when the different
kinds of updates no longer are handled that differently. Standins for added
files are however only written when doing a normal update, while deleted and
removed files only will be updated for --clean updates.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 15 Apr 2015 15:22:16 -0400 |
parents | 352abbb0be88 |
children | d289b8847f23 |
rev | line source |
---|---|
14449
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 import os |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 from mercurial import ui, commands, extensions |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 |
20622
352abbb0be88
extensions: remove the inotify extension (BC)
Matt Mackall <mpm@selenic.com>
parents:
16383
diff
changeset
|
4 ignore = set(['highlight', 'win32text', 'factotum']) |
14449
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 if os.name != 'nt': |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 ignore.add('win32mbcs') |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 disabled = [ext for ext in extensions.disabled().keys() if ext not in ignore] |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 hgrc = open(os.environ["HGRCPATH"], 'w') |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 hgrc.write('[extensions]\n') |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 for ext in disabled: |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 hgrc.write(ext + '=\n') |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 hgrc.close() |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
18 |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
19 u = ui.ui() |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
20 extensions.loadall(u) |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 |
15099
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
22 globalshort = set() |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
23 globallong = set() |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
24 for option in commands.globalopts: |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
25 option[0] and globalshort.add(option[0]) |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
26 option[1] and globallong.add(option[1]) |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
27 |
14449
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
28 for cmd, entry in commands.table.iteritems(): |
15099
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
29 seenshort = globalshort.copy() |
b1f49efeab65
test: test for options duplicate with global options
Simon Heimberg <simohe@besonet.ch>
parents:
14762
diff
changeset
|
30 seenlong = globallong.copy() |
14449
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
31 for option in entry[1]: |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 if (option[0] and option[0] in seenshort) or \ |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
33 (option[1] and option[1] in seenlong): |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
34 print "command '" + cmd + "' has duplicate option " + str(option) |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
35 seenshort.add(option[0]) |
7d171c05a631
tests: add a test to check for duplicate command options
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
36 seenlong.add(option[1]) |