annotate tests/test-narrow-copies.t @ 41163:0101a35deae2

phabricator: warn if unable to amend, instead of aborting after posting There was a divergence in behavior here between obsolete and strip based amending. I first noticed the abort when testing outside of the test harness, but then had trouble recreating it here after reverting the code changes. It turns out, strip based amend was successfully amending the public commit after it was posted! It looks like the protection is in the `commit --amend` command, not in the underlying code that it calls. I considered doing a preflight check and aborting. But the locks are only acquired at the end, if amending, and this is too large a section of code to be wrapped in a maybe-it's-held-or-not context manager for my tastes. Additionally, some people do post-push reviews, and amending is the default behavior, so they shouldn't see a misleading error message. The lack of a 'Differential Revision' entry in the commit message breaks a {phabreview} test, so it had to be partially conditionalized.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 05 Jan 2019 15:20:33 -0500
parents 07a66c1387d1
children f90a5c211251
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36079
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
2 $ . "$TESTDIR/narrow-library.sh"
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
3
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
4 create full repo
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
5
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
6 $ hg init master
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
7 $ cd master
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
8
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
9 $ mkdir inside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
10 $ echo inside > inside/f1
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
11 $ mkdir outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
12 $ echo outside > outside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
13 $ hg ci -Aqm 'initial'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
14
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
15 $ hg mv outside/f2 inside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
16 $ hg ci -qm 'move f2 from outside'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
17
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
18 $ echo modified > inside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
19 $ hg ci -qm 'modify inside/f2'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
20
40447
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
21 $ mkdir outside
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
22 $ echo new > outside/f3
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
23 $ hg ci -Aqm 'add outside/f3'
36079
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
24 $ cd ..
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
25
40447
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
26 $ hg clone --narrow ssh://user@dummy/master narrow --include inside -r 2
36079
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
27 adding changesets
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
28 adding manifests
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
29 adding file changes
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
30 added 3 changesets with 3 changes to 2 files
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
31 new changesets *:* (glob)
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
32 updating to branch default
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
34 $ cd narrow
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
35
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
36 $ hg co 'desc("move f2")'
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
38 $ hg status
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
39 $ hg diff
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
40 $ hg diff --change . --git
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
41 diff --git a/inside/f2 b/inside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
42 new file mode 100644
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
43 --- /dev/null
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
44 +++ b/inside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
45 @@ -0,0 +1,1 @@
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
46 +outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
47
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
48 $ hg log --follow inside/f2 -r tip
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
49 changeset: 2:bcfb756e0ca9
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
50 tag: tip
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
51 user: test
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
52 date: Thu Jan 01 00:00:00 1970 +0000
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
53 summary: modify inside/f2
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
54
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
55 changeset: 1:5a016133b2bb
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
56 user: test
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
57 date: Thu Jan 01 00:00:00 1970 +0000
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
58 summary: move f2 from outside
a2a6e724d61a narrow: import experimental extension from narrowhg revision cb51d673e9c5
Augie Fackler <augie@google.com>
parents:
diff changeset
59
40447
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
60 $ echo new > inside/f4
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
61 $ hg ci -Aqm 'add inside/f4'
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
62 $ hg pull -q
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
63 $ hg --config extensions.rebase= rebase -d tip
f1c1b4d0e695 tests: demonstrate broken copies.pathcopies()
Martin von Zweigbergk <martinvonz@google.com>
parents: 36079
diff changeset
64 rebasing 3:4f84b666728c "add inside/f4"
40448
873f3682c8af narrow: make copies.pathcopies() filter with narrowspec again
Martin von Zweigbergk <martinvonz@google.com>
parents: 40447
diff changeset
65 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/4f84b666728c-4269b76e-rebase.hg
40449
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
66
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
67 $ hg co -q 0
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
68 $ echo modified > inside/f1
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
69 $ hg ci -qm 'modify inside/f1'
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
70 $ echo new > inside/f5
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
71 $ hg ci -Aqm 'add inside/f5'
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
72 $ hg --config extensions.rebase= rebase -d 'public()' -r .
d049ee8eee00 tests: demonstrate broken copies._fullcopytracing()
Martin von Zweigbergk <martinvonz@google.com>
parents: 40448
diff changeset
73 rebasing 6:610b60178c28 "add inside/f5" (tip)
40450
07a66c1387d1 narrow: fix copies._fullcopytracing() narrowspec filtering in graft case
Martin von Zweigbergk <martinvonz@google.com>
parents: 40449
diff changeset
74 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/610b60178c28-65716a78-rebase.hg