annotate tests/test-addremove.t @ 23575:a2f139d25845

subrepo: drop the 'ui' parameter to archive() The current state of subrepo methods is to pass a 'ui' object to some methods, which has the effect of overriding the subrepo configuration since it is the root repo's 'ui' that is passed along as deep as there are subrepos. Other subrepo method are *not* passed the root 'ui', and instead delegate to their repo object's 'ui'. Even in the former case where the root 'ui' is available, some methods are inconsistent in their use of both the root 'ui' and the local repo's 'ui'. (Consider hg._incoming() uses the root 'ui' for path expansion and some status messages, but also calls bundlerepo.getremotechanges(), which eventually calls discovery.findcommonincoming(), which calls setdiscovery.findcommonheads(), which calls status() on the local repo 'ui'.) This inconsistency with respect to the configured output level is probably always hidden, because --verbose, --debug and --quiet, along with their 'ui.xxx' equivalents in the global and user level hgrc files are propagated from the parent repo to the subrepo via 'baseui'. The 'ui.xxx' settings in the parent repo hgrc file are not propagated, but that seems like an unusual thing to set on a per repo config file. Any 'ui.xxx' options changed by --config are also not propagated, because they are set on repo.ui by dispatch.py, not repo.baseui. The goal here is to cleanup the subrepo methods by dropping the 'ui' parameter, which in turn prevents mixing subtly different 'ui' instances on a given subrepo level. Some methods use more than just the output level settings in 'ui' (add for example ends up calling scmutil.checkportabilityalert() with both the root and local repo's 'ui' at different points). This series just goes for the low hanging fruit and switches methods that only use the output level. If we really care about not letting a subrepo config override the root repo's output level, we can propagate the verbose, debug and quiet settings to the subrepo in the same way 'ui.commitsubrepos' is in hgsubrepo.__init__. Archive only uses the 'ui' object to call its progress() method, and gitsubrepo calls status().
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 13 Dec 2014 14:53:46 -0500
parents 72c23fa4f52f
children a387b0390082
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
1 $ hg init rep
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
2 $ cd rep
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
3 $ mkdir dir
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
4 $ touch foo dir/bar
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
5 $ hg -v addremove
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
6 adding dir/bar
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
7 adding foo
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11850
diff changeset
8 $ hg -v commit -m "add 1"
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
9 dir/bar
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
10 foo
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11850
diff changeset
11 committed changeset 0:6f7f953567a2
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
12 $ cd dir/
16874
8017ac7a0e8f test-addremove: remove bits about con.xml
Adrian Buehlmann <adrian@cadifra.com>
parents: 15444
diff changeset
13 $ touch ../foo_2 bar_2
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
14 $ hg -v addremove
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
15 adding dir/bar_2
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
16 adding foo_2
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11850
diff changeset
17 $ hg -v commit -m "add 2"
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
18 dir/bar_2
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
19 foo_2
16874
8017ac7a0e8f test-addremove: remove bits about con.xml
Adrian Buehlmann <adrian@cadifra.com>
parents: 15444
diff changeset
20 committed changeset 1:e65414bf35c5
23259
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
21 $ cd ..
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
22 $ hg forget foo
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
23 $ hg -v addremove
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
24 adding foo
23534
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
25 $ hg forget foo
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
26 #if windows
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
27 $ hg -v addremove nonexistant
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
28 nonexistant: The system cannot find the file specified
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
29 [1]
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
30 #else
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
31 $ hg -v addremove nonexistant
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
32 nonexistant: No such file or directory
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
33 [1]
83bbedc16b3f addremove: warn when addremove fails to operate on a named path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23427
diff changeset
34 #endif
23259
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
35 $ cd ..
2958
ff3ea21a981a addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1933
diff changeset
36
23427
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
37 $ hg init subdir
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
38 $ cd subdir
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
39 $ mkdir dir
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
40 $ cd dir
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
41 $ touch a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
42 $ hg addremove 'glob:*.py'
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
43 adding a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
44 $ hg forget a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
45 $ hg addremove -I 'glob:*.py'
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
46 adding a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
47 $ hg forget a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
48 $ hg addremove
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
49 adding dir/a.py
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
50 $ cd ..
3778884197f0 addremove: print relative paths when called with -I/-X (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 23259
diff changeset
51
11850
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
52 $ hg init sim
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
53 $ cd sim
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
54 $ echo a > a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
55 $ echo a >> a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
56 $ echo a >> a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
57 $ echo c > c
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
58 $ hg commit -Ama
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
59 adding a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
60 adding c
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
61 $ mv a b
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
62 $ rm c
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
63 $ echo d > d
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
64 $ hg addremove -n -s 50 # issue 1696
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
65 removing a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
66 adding b
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
67 removing c
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
68 adding d
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
69 recording removal of a as rename to b (100% similar)
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
70 $ hg addremove -s 50
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
71 removing a
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
72 adding b
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
73 removing c
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
74 adding d
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
75 recording removal of a as rename to b (100% similar)
54dbf16b401f tests: unify test-addremove
Martin Geisler <mg@lazybytes.net>
parents: 8990
diff changeset
76 $ hg commit -mb
23259
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
77 $ cp b c
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
78 $ hg forget b
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
79 $ hg addremove -s 50
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
80 adding b
9f4778027bc2 addremove: add back forgotten files (BC)
Martin von Zweigbergk <martinvonz@google.com>
parents: 16912
diff changeset
81 adding c
23535
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
82
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
83 $ rm c
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
84 #if windows
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
85 $ hg ci -A -m "c" nonexistant
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
86 nonexistant: The system cannot find the file specified
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
87 abort: failed to mark all new/missing files as added/removed
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
88 [255]
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
89 #else
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
90 $ hg ci -A -m "c" nonexistant
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
91 nonexistant: No such file or directory
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
92 abort: failed to mark all new/missing files as added/removed
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
93 [255]
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
94 #endif
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
95 $ hg st
72c23fa4f52f commit: abort if --addremove is specified, but fails
Matt Harbison <matt_harbison@yahoo.com>
parents: 23534
diff changeset
96 ! c
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16874
diff changeset
97 $ cd ..