Mercurial > hg
annotate tests/test-symlink-os-yes-fs-no.py @ 26228:0fd20a71abdb
extdiff: add a --patch argument for diffing changeset deltas
One of the things I missed the most when transitioning from versioned MQ to
evolve was the loss of being able to check that rebase conflicts were properly
resolved by:
$ hg ci --mq -m "before"
$ hg rebase -s qbase -d tip
$ hg bcompare --mq
The old csets stay in the tree with evolve, but a straight diff includes all of
the other changes that were pulled in, obscuring the code that was rebased.
Diffing deltas can be confusing, but unless radical changes were made during the
resolve, it is very clear when individual hunks are added, dropped or modified.
Unlike the MQ technique, this can only compare a single pair of csets/patches at
a time. Like the MQ method, this also highlights changes in the commit comment
and other metadata.
I originally tried monkey patching from the evolve extension, but that is too
complicated given that it depends on the order the two different extensions are
loaded. This functionality is also useful when comparing grafts however, so
implementing it in the core is more than just convenience.
The --change argument doesn't make much sense for this, but it isn't harmful so
I didn't bother blocking it. The -I/-X options are ignored because of a
limitation of cmdutil.export(). We'll fix that next.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 09 Sep 2015 21:07:38 -0400 |
parents | 6ae45c0b4625 |
children | 3b453513f1fe |
rev | line source |
---|---|
11769
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
1 import os, sys, time |
14168
135e244776f0
prevent transient leaks of file handle by using new helper functions
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
14116
diff
changeset
|
2 from mercurial import hg, ui, commands, util |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
3 |
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
4 TESTDIR = os.environ["TESTDIR"] |
14116
cd3032437064
tests: move test bundles in a bundles/ subdirectory
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11769
diff
changeset
|
5 BUNDLEPATH = os.path.join(TESTDIR, 'bundles', 'test-no-symlinks.hg') |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
6 |
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
7 # only makes sense to test on os which supports symlinks |
14971
0b21ae0a2366
tests: use getattr instead of hasattr
Augie Fackler <durin42@gmail.com>
parents:
14553
diff
changeset
|
8 if not getattr(os, "symlink", False): |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
9 sys.exit(80) # SKIPPED_STATUS defined in run-tests.py |
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
10 |
17015
73d20de5f30b
tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents:
14971
diff
changeset
|
11 u = ui.ui() |
73d20de5f30b
tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents:
14971
diff
changeset
|
12 # hide outer repo |
73d20de5f30b
tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents:
14971
diff
changeset
|
13 hg.peer(u, {}, '.', create=True) |
73d20de5f30b
tests: add missing no-outer-repo requirements
Mads Kiilerich <mads@kiilerich.com>
parents:
14971
diff
changeset
|
14 |
11769
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
15 # clone with symlink support |
14553
d976542986d2
hg: add opts argument to clone for internal remoteui
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14168
diff
changeset
|
16 hg.clone(u, {}, BUNDLEPATH, 'test0') |
11769
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
17 |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
18 repo = hg.repository(u, 'test0') |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
19 |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
20 # wait a bit, or the status call wont update the dirstate |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
21 time.sleep(1) |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
22 commands.status(u, repo) |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
23 |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
24 # now disable symlink support -- this is what os.symlink would do on a |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
25 # non-symlink file system |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
26 def symlink_failure(src, dst): |
18178
6ae45c0b4625
test-symlink-os-yes-fs-no.py: clean up use of two-argument raise
Augie Fackler <raf@durin42.com>
parents:
17015
diff
changeset
|
27 raise OSError(1, "Operation not permitted") |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
28 os.symlink = symlink_failure |
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
29 |
11769
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
30 # dereference links as if a Samba server has exported this to a |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
31 # Windows client |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
32 for f in 'test0/a.lnk', 'test0/d/b.lnk': |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
33 os.unlink(f) |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
34 fp = open(f, 'wb') |
14168
135e244776f0
prevent transient leaks of file handle by using new helper functions
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
14116
diff
changeset
|
35 fp.write(util.readfile(f[:-4])) |
11769
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
36 fp.close() |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
37 |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
38 # reload repository |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
39 u = ui.ui() |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
40 repo = hg.repository(u, 'test0') |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
41 commands.status(u, repo) |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
42 |
ca6cebd8734e
dirstate: ignore symlinks when fs cannot handle them (issue1888)
Martin Geisler <mg@aragost.com>
parents:
6879
diff
changeset
|
43 # try cloning a repo which contains symlinks |
6879
24fd94ed1cc0
test symlinks on symlink-capable os but non-capable filesystem (issue1149)
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
44 u = ui.ui() |
14553
d976542986d2
hg: add opts argument to clone for internal remoteui
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14168
diff
changeset
|
45 hg.clone(u, {}, BUNDLEPATH, 'test1') |