Mercurial > hg
comparison tests/test-rebase-inmemory.t @ 35384:b9bdee046cc2
tests: add a simple test for in-memory rebase
This is just a very simple start, but verifies some of the basic cases of an
in-memory rebase.
Differential Revision: https://phab.mercurial-scm.org/D1652
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Sun, 10 Dec 2017 22:39:46 -0800 |
parents | |
children | dd11df900f7f |
comparison
equal
deleted
inserted
replaced
35383:82c3762349ac | 35384:b9bdee046cc2 |
---|---|
1 #require symlink execbit | |
2 $ cat << EOF >> $HGRCPATH | |
3 > [extensions] | |
4 > amend= | |
5 > rebase= | |
6 > debugdrawdag=$TESTDIR/drawdag.py | |
7 > [diff] | |
8 > git=1 | |
9 > [alias] | |
10 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n" | |
11 > EOF | |
12 | |
13 Rebase a simple DAG: | |
14 $ hg init repo1 | |
15 $ cd repo1 | |
16 $ hg debugdrawdag <<'EOS' | |
17 > c b | |
18 > |/ | |
19 > d | |
20 > | | |
21 > a | |
22 > EOS | |
23 $ hg up -C a | |
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
25 $ hg tglog | |
26 o 3: 814f6bd05178 'c' | |
27 | | |
28 | o 2: db0e82a16a62 'b' | |
29 |/ | |
30 o 1: 02952614a83d 'd' | |
31 | | |
32 @ 0: b173517d0057 'a' | |
33 | |
34 $ hg cat -r 3 c | |
35 c (no-eol) | |
36 $ hg cat -r 2 b | |
37 b (no-eol) | |
38 $ hg rebase --inmemory --debug -r b -d c | grep rebasing | |
39 rebasing in-memory | |
40 rebasing 2:db0e82a16a62 "b" (b) | |
41 $ hg tglog | |
42 o 3: ca58782ad1e4 'b' | |
43 | | |
44 o 2: 814f6bd05178 'c' | |
45 | | |
46 o 1: 02952614a83d 'd' | |
47 | | |
48 @ 0: b173517d0057 'a' | |
49 | |
50 $ hg cat -r 3 b | |
51 b (no-eol) | |
52 $ hg cat -r 2 c | |
53 c (no-eol) | |
54 | |
55 Case 2: | |
56 $ hg init repo2 | |
57 $ cd repo2 | |
58 $ hg debugdrawdag <<'EOS' | |
59 > c b | |
60 > |/ | |
61 > d | |
62 > | | |
63 > a | |
64 > EOS | |
65 | |
66 Add a symlink and executable file: | |
67 $ hg up -C c | |
68 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
69 $ ln -s somefile e | |
70 $ echo f > f | |
71 $ chmod +x f | |
72 $ hg add e f | |
73 $ hg amend -q | |
74 $ hg up -Cq a | |
75 | |
76 Write files to the working copy, and ensure they're still there after the rebase | |
77 $ echo "abc" > a | |
78 $ ln -s def b | |
79 $ echo "ghi" > c | |
80 $ echo "jkl" > d | |
81 $ echo "mno" > e | |
82 $ hg tglog | |
83 o 3: f56b71190a8f 'c' | |
84 | | |
85 | o 2: db0e82a16a62 'b' | |
86 |/ | |
87 o 1: 02952614a83d 'd' | |
88 | | |
89 @ 0: b173517d0057 'a' | |
90 | |
91 $ hg cat -r 3 c | |
92 c (no-eol) | |
93 $ hg cat -r 2 b | |
94 b (no-eol) | |
95 $ hg cat -r 3 e | |
96 somefile (no-eol) | |
97 $ hg rebase --inmemory --debug -s b -d a | grep rebasing | |
98 rebasing in-memory | |
99 rebasing 2:db0e82a16a62 "b" (b) | |
100 $ hg tglog | |
101 o 3: fc055c3b4d33 'b' | |
102 | | |
103 | o 2: f56b71190a8f 'c' | |
104 | | | |
105 | o 1: 02952614a83d 'd' | |
106 |/ | |
107 @ 0: b173517d0057 'a' | |
108 | |
109 $ hg cat -r 2 c | |
110 c (no-eol) | |
111 $ hg cat -r 3 b | |
112 b (no-eol) | |
113 $ hg rebase --inmemory --debug -s 1 -d 3 | grep rebasing | |
114 rebasing in-memory | |
115 rebasing 1:02952614a83d "d" (d) | |
116 rebasing 2:f56b71190a8f "c" | |
117 $ hg tglog | |
118 o 3: 753feb6fd12a 'c' | |
119 | | |
120 o 2: 09c044d2cb43 'd' | |
121 | | |
122 o 1: fc055c3b4d33 'b' | |
123 | | |
124 @ 0: b173517d0057 'a' | |
125 | |
126 Ensure working copy files are still there: | |
127 $ cat a | |
128 abc | |
129 $ readlink.py b | |
130 b -> def | |
131 $ cat e | |
132 mno | |
133 | |
134 Ensure symlink and executable files were rebased properly: | |
135 $ hg up -Cq 3 | |
136 $ readlink.py e | |
137 e -> somefile | |
138 $ ls -l f | cut -c -10 | |
139 -rwxr-xr-x | |
140 | |
141 Rebase the working copy parent, which should default to an on-disk merge even if | |
142 we requested in-memory. | |
143 $ hg up -C 3 | |
144 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
145 $ hg rebase -r 3 -d 0 --inmemory --debug | grep rebasing | |
146 rebasing on disk | |
147 rebasing 3:753feb6fd12a "c" (tip) | |
148 $ hg tglog | |
149 @ 3: 844a7de3e617 'c' | |
150 | | |
151 | o 2: 09c044d2cb43 'd' | |
152 | | | |
153 | o 1: fc055c3b4d33 'b' | |
154 |/ | |
155 o 0: b173517d0057 'a' | |
156 | |
157 |