Mercurial > hg
annotate tests/test-fetch.t @ 24545:9e0c67e84896
json: implement {tags} template
Tags is pretty easy to implement. Let's start there.
The output is slightly different from `hg tags -Tjson`. For reference,
the CLI has the following output:
[
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"rev": 29880,
"tag": "tip",
"type": ""
},
...
]
Our output has the format:
{
"node": "0aeb19ea57a6d223bacddda3871cb78f24b06510",
"tags": [
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"tag": "tag1",
"date": [1427775457.0, 25200]
},
...
]
}
"rev" is omitted because it isn't a reliable identifier. We shouldn't
be exposing them in web APIs and giving the impression it remotely
resembles a stable identifier. Perhaps we could one day hide this behind
a config option (it might be useful to expose when running servers
locally).
The "type" of the tag isn't defined because this information isn't yet
exposed to the hgweb templater (it could be in a follow-up) and because
it is questionable whether different types should be exposed at all.
(Should the web interface really be exposing "local" tags?)
We use an object for the outer type instead of Array for a few reasons.
First, it is extensible. If we ever need to throw more global properties
into the output, we can do that without breaking backwards compatibility
(property additions should be backwards compatible). Second, uniformity
in web APIs is nice. Having everything return objects seems much saner than
a mix of array and object. Third, there are security issues with arrays
in older browsers. The JSON web services world almost never uses arrays
as the main type for this reason.
Another possibly controversial part about this patch is how dates are
defined. While JSON has a Date type, it is based on the JavaScript Date
type, which is widely considered a pile of garbage. It is a non-starter
for this reason.
Many of Mercurial's built-in date filters drop seconds resolution. So
that's a non-starter as well, since we want the API to be lossless where
possible. rfc3339date, rfc822date, isodatesec, and date are all lossless.
However, they each require the client to perform string parsing on top of
JSON decoding. While date parsing libraries are pretty ubiquitous, some
languages don't have them out of the box. However, pretty much every
programming language can deal with UNIX timestamps (which are just
integers or floats). So, we choose to use Mercurial's internal date
representation, which in JSON is modeled as float seconds since UNIX
epoch and an integer timezone offset from UTC (keep in mind
JavaScript/JSON models all "Numbers" as double prevision floating point
numbers, so there isn't a difference between ints and floats in JSON).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 14:52:21 -0700 |
parents | 55fd99a23fdc |
children | 701df761aa94 |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
21406
diff
changeset
|
1 #require serve |
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
15244
diff
changeset
|
2 |
12426 | 3 $ echo "[extensions]" >> $HGRCPATH |
4 $ echo "fetch=" >> $HGRCPATH | |
6246
35bf9c23e17a
adjust test-fetch output to non-default HGPORT, e.g. with run-tests.py -j
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6235
diff
changeset
|
5 |
12426 | 6 test fetch with default branches only |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
7 |
12426 | 8 $ hg init a |
9 $ echo a > a/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
10 $ hg --cwd a commit -Ama |
12426 | 11 adding a |
12 $ hg clone a b | |
13 updating to branch default | |
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15 $ hg clone a c | |
16 updating to branch default | |
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
18 $ echo b > a/b | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
19 $ hg --cwd a commit -Amb |
12426 | 20 adding b |
21 $ hg --cwd a parents -q | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
22 1:d2ae7f538514 |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 |
12426 | 24 should pull one change |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 |
12426 | 26 $ hg --cwd b fetch ../a |
27 pulling from ../a | |
28 searching for changes | |
29 adding changesets | |
30 adding manifests | |
31 adding file changes | |
32 added 1 changesets with 1 changes to 1 files | |
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 $ hg --cwd b parents -q | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
35 1:d2ae7f538514 |
12426 | 36 $ echo c > c/c |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
37 $ hg --cwd c commit -Amc |
12426 | 38 adding c |
39 $ hg clone c d | |
40 updating to branch default | |
41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 $ hg clone c e | |
43 updating to branch default | |
44 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2822
4f7abf341cd4
fetch: fix breakage from mpm.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
45 |
12426 | 46 We cannot use the default commit message if fetching from a local |
47 repo, because the path of the repo will be included in the commit | |
48 message, making every commit appear different. | |
49 should merge c into a | |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
50 |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
51 $ hg --cwd c fetch -d '0 0' -m 'automated merge' ../a |
12426 | 52 pulling from ../a |
53 searching for changes | |
54 adding changesets | |
55 adding manifests | |
56 adding file changes | |
57 added 1 changesets with 1 changes to 1 files (+1 heads) | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
58 updating to 2:d2ae7f538514 |
12426 | 59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
60 merging with 1:d36c0562f908 |
12426 | 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
62 new changeset 3:a323a0c43ec4 merges remote changes with local |
12426 | 63 $ ls c |
64 a | |
65 b | |
66 c | |
67 $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid | |
68 $ cat a/hg.pid >> "$DAEMON_PIDS" | |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
69 |
12426 | 70 fetch over http, no auth |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
71 (this also tests that editor is invoked if '--edit' is specified) |
5798
86f5d8f608b7
fetch: hide authentication details
Bryan O'Sullivan <bos@serpentine.com>
parents:
2990
diff
changeset
|
72 |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
73 $ HGEDITOR=cat hg --cwd d fetch --edit http://localhost:$HGPORT/ |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
74 pulling from http://localhost:$HGPORT/ |
12426 | 75 searching for changes |
76 adding changesets | |
77 adding manifests | |
78 adding file changes | |
79 added 1 changesets with 1 changes to 1 files (+1 heads) | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
80 updating to 2:d2ae7f538514 |
12426 | 81 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
82 merging with 1:d36c0562f908 |
12426 | 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
84 Automated merge with http://localhost:$HGPORT/ |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
85 |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
86 |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
87 HG: Enter commit message. Lines beginning with 'HG:' are removed. |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
88 HG: Leave message empty to abort commit. |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
89 HG: -- |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
90 HG: user: test |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
91 HG: branch merge |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
92 HG: branch 'default' |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
93 HG: changed c |
12535
975ec4ce961c
tests: fix test-fetch port number variability
Matt Mackall <mpm@selenic.com>
parents:
12426
diff
changeset
|
94 new changeset 3:* merges remote changes with local (glob) |
12426 | 95 $ hg --cwd d tip --template '{desc}\n' |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
96 Automated merge with http://localhost:$HGPORT/ |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
97 $ hg --cwd d status --rev 'tip^1' --rev tip |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
98 A c |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
99 $ hg --cwd d status --rev 'tip^2' --rev tip |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
100 A b |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
101 |
12426 | 102 fetch over http with auth (should be hidden in desc) |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
103 (this also tests that editor is not invoked if '--edit' is not |
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
104 specified, even though commit message is not specified explicitly) |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
105 |
21406
288a793c3167
fetch: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
16913
diff
changeset
|
106 $ HGEDITOR=cat hg --cwd e fetch http://user:password@localhost:$HGPORT/ |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
107 pulling from http://user:***@localhost:$HGPORT/ |
12426 | 108 searching for changes |
109 adding changesets | |
110 adding manifests | |
111 adding file changes | |
112 added 1 changesets with 1 changes to 1 files (+1 heads) | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
113 updating to 2:d2ae7f538514 |
12426 | 114 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
115 merging with 1:d36c0562f908 |
12426 | 116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
12535
975ec4ce961c
tests: fix test-fetch port number variability
Matt Mackall <mpm@selenic.com>
parents:
12426
diff
changeset
|
117 new changeset 3:* merges remote changes with local (glob) |
12426 | 118 $ hg --cwd e tip --template '{desc}\n' |
12643
d08bb64888bc
tests: reintroduce ":$HGPORT" in test output
Mads Kiilerich <mads@kiilerich.com>
parents:
12535
diff
changeset
|
119 Automated merge with http://localhost:$HGPORT/ |
12426 | 120 $ hg clone a f |
121 updating to branch default | |
122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
123 $ hg clone a g | |
124 updating to branch default | |
125 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
126 $ echo f > f/f | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
127 $ hg --cwd f ci -Amf |
12426 | 128 adding f |
129 $ echo g > g/g | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
130 $ hg --cwd g ci -Amg |
12426 | 131 adding g |
132 $ hg clone -q f h | |
133 $ hg clone -q g i | |
6206
0b6f12495276
fetch: switch the default parent used for a merge
Bryan O'Sullivan <bos@serpentine.com>
parents:
5798
diff
changeset
|
134 |
12426 | 135 should merge f into g |
6226
bd61e44eb2cc
fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents:
6207
diff
changeset
|
136 |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
137 $ hg --cwd g fetch -d '0 0' --switch -m 'automated merge' ../f |
12426 | 138 pulling from ../f |
139 searching for changes | |
140 adding changesets | |
141 adding manifests | |
142 adding file changes | |
143 added 1 changesets with 1 changes to 1 files (+1 heads) | |
144 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
145 merging with 3:6343ca3eff20 |
12426 | 146 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
147 new changeset 4:f7faa0b7d3c6 merges remote changes with local |
12426 | 148 $ rm i/g |
6226
bd61e44eb2cc
fetch: don't proceed if working directory is missing files (issue988)
Bryan O'Sullivan <bos@serpentine.com>
parents:
6207
diff
changeset
|
149 |
12426 | 150 should abort, because i is modified |
6235
d16798000be0
test-fetch failed due to non-zero exit code
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6226
diff
changeset
|
151 |
12426 | 152 $ hg --cwd i fetch ../h |
22676
a014fdc97154
fetch: use cmdutil.bailifchanged()
Martin von Zweigbergk <martinvonz@gmail.com>
parents:
22046
diff
changeset
|
153 abort: uncommitted changes |
12426 | 154 [255] |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
155 |
12426 | 156 test fetch with named branches |
157 | |
158 $ hg init nbase | |
159 $ echo base > nbase/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
160 $ hg -R nbase ci -Am base |
12426 | 161 adding a |
162 $ hg -R nbase branch a | |
163 marked working directory as branch a | |
15615 | 164 (branches are permanent and global, did you want a bookmark?) |
12426 | 165 $ echo a > nbase/a |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
166 $ hg -R nbase ci -m a |
12426 | 167 $ hg -R nbase up -C 0 |
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
169 $ hg -R nbase branch b | |
170 marked working directory as branch b | |
15615 | 171 (branches are permanent and global, did you want a bookmark?) |
12426 | 172 $ echo b > nbase/b |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
173 $ hg -R nbase ci -Am b |
12426 | 174 adding b |
175 | |
176 pull in change on foreign branch | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
177 |
12426 | 178 $ hg clone nbase n1 |
179 updating to branch default | |
180 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
181 $ hg clone nbase n2 | |
182 updating to branch default | |
183 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
184 $ hg -R n1 up -C a | |
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
186 $ echo aa > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
187 $ hg -R n1 ci -m a1 |
12426 | 188 $ hg -R n2 up -C b |
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
190 $ hg -R n2 fetch -m 'merge' n1 |
12426 | 191 pulling from n1 |
192 searching for changes | |
193 adding changesets | |
194 adding manifests | |
195 adding file changes | |
196 added 1 changesets with 1 changes to 1 files | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
197 |
12426 | 198 parent should be 2 (no automatic update) |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
199 |
12426 | 200 $ hg -R n2 parents --template '{rev}\n' |
201 2 | |
202 $ rm -fr n1 n2 | |
203 | |
204 pull in changes on both foreign and local branches | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
205 |
12426 | 206 $ hg clone nbase n1 |
207 updating to branch default | |
208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
209 $ hg clone nbase n2 | |
210 updating to branch default | |
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
212 $ hg -R n1 up -C a | |
213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
214 $ echo aa > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
215 $ hg -R n1 ci -m a1 |
12426 | 216 $ hg -R n1 up -C b |
217 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
218 $ echo bb > n1/b | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
219 $ hg -R n1 ci -m b1 |
12426 | 220 $ hg -R n2 up -C b |
221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
222 $ hg -R n2 fetch -m 'merge' n1 |
12426 | 223 pulling from n1 |
224 searching for changes | |
225 adding changesets | |
226 adding manifests | |
227 adding file changes | |
228 added 2 changesets with 2 changes to 2 files | |
229 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
230 |
12426 | 231 parent should be 4 (fast forward) |
232 | |
233 $ hg -R n2 parents --template '{rev}\n' | |
234 4 | |
235 $ rm -fr n1 n2 | |
236 | |
237 pull changes on foreign (2 new heads) and local (1 new head) branches | |
238 with a local change | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
239 |
12426 | 240 $ hg clone nbase n1 |
241 updating to branch default | |
242 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
243 $ hg clone nbase n2 | |
244 updating to branch default | |
245 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
246 $ hg -R n1 up -C a | |
247 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
248 $ echo a1 > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
249 $ hg -R n1 ci -m a1 |
12426 | 250 $ hg -R n1 up -C b |
251 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
252 $ echo bb > n1/b | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
253 $ hg -R n1 ci -m b1 |
12426 | 254 $ hg -R n1 up -C 1 |
255 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
256 $ echo a2 > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
257 $ hg -R n1 ci -m a2 |
12426 | 258 created new head |
259 $ hg -R n2 up -C b | |
260 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
261 $ echo change >> n2/c | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
262 $ hg -R n2 ci -A -m local |
12426 | 263 adding c |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
264 $ hg -R n2 fetch -d '0 0' -m 'merge' n1 |
12426 | 265 pulling from n1 |
266 searching for changes | |
267 adding changesets | |
268 adding manifests | |
269 adding file changes | |
270 added 3 changesets with 3 changes to 2 files (+2 heads) | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
271 updating to 5:3c4a837a864f |
12426 | 272 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
273 merging with 3:1267f84a9ea5 |
12426 | 274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
275 new changeset 7:2cf2a1261f21 merges remote changes with local |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
276 |
12426 | 277 parent should be 7 (new merge changeset) |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
278 |
12426 | 279 $ hg -R n2 parents --template '{rev}\n' |
280 7 | |
281 $ rm -fr n1 n2 | |
282 | |
283 pull in changes on foreign (merge of local branch) and local (2 new | |
284 heads) with a local change | |
7007
a6b74fbb5ce0
fetch: added support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
6246
diff
changeset
|
285 |
12426 | 286 $ hg clone nbase n1 |
287 updating to branch default | |
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
289 $ hg clone nbase n2 | |
290 updating to branch default | |
291 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
292 $ hg -R n1 up -C a | |
293 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
294 $ hg -R n1 merge b | |
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
296 (branch merge, don't forget to commit) | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
297 $ hg -R n1 ci -m merge |
12426 | 298 $ hg -R n1 up -C 2 |
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
300 $ echo c > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
301 $ hg -R n1 ci -m c |
12426 | 302 $ hg -R n1 up -C 2 |
303 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
304 $ echo cc > n1/a | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
305 $ hg -R n1 ci -m cc |
12426 | 306 created new head |
307 $ hg -R n2 up -C b | |
308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
309 $ echo change >> n2/b | |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
310 $ hg -R n2 ci -A -m local |
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
311 $ hg -R n2 fetch -m 'merge' n1 |
12426 | 312 pulling from n1 |
313 searching for changes | |
314 adding changesets | |
315 adding manifests | |
316 adding file changes | |
317 added 3 changesets with 2 changes to 1 files (+2 heads) | |
318 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them) | |
12711
b885f28fa4fa
fetch: fix and document exit codes (issue2356)
Matt Mackall <mpm@selenic.com>
parents:
12643
diff
changeset
|
319 [1] |
7049
6489ee64b522
fetch: use dirstate branch instead of first parents
Sune Foldager <cryo@cyanite.org>
parents:
7007
diff
changeset
|
320 |
12426 | 321 parent should be 3 (fetch did not merge anything) |
322 | |
323 $ hg -R n2 parents --template '{rev}\n' | |
324 3 | |
325 $ rm -fr n1 n2 | |
326 | |
327 pull in change on different branch than dirstate | |
328 | |
329 $ hg init n1 | |
330 $ echo a > n1/a | |
331 $ hg -R n1 ci -Am initial | |
332 adding a | |
333 $ hg clone n1 n2 | |
334 updating to branch default | |
335 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
336 $ echo b > n1/a | |
337 $ hg -R n1 ci -m next | |
338 $ hg -R n2 branch topic | |
339 marked working directory as branch topic | |
15615 | 340 (branches are permanent and global, did you want a bookmark?) |
15244
f6d5d01725db
tests: cleanup of test-fetch.t
Mads Kiilerich <mads@kiilerich.com>
parents:
15243
diff
changeset
|
341 $ hg -R n2 fetch -m merge n1 |
24368
55fd99a23fdc
fetch: use an abort hint where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
24365
diff
changeset
|
342 abort: working directory not at branch tip |
55fd99a23fdc
fetch: use an abort hint where appropriate
Yuya Nishihara <yuya@tcha.org>
parents:
24365
diff
changeset
|
343 (use "hg update" to check out branch tip) |
12426 | 344 [255] |
345 | |
346 parent should be 0 (fetch did not update or merge anything) | |
347 | |
348 $ hg -R n2 parents --template '{rev}\n' | |
349 0 | |
350 $ rm -fr n1 n2 | |
351 | |
352 test fetch with inactive branches | |
7855
aa1a87f7544f
regression test for issue1552
Benjamin Pollack <benjamin@bitquabit.com>
parents:
7344
diff
changeset
|
353 |
12426 | 354 $ hg init ib1 |
355 $ echo a > ib1/a | |
356 $ hg --cwd ib1 ci -Am base | |
357 adding a | |
358 $ hg --cwd ib1 branch second | |
359 marked working directory as branch second | |
15615 | 360 (branches are permanent and global, did you want a bookmark?) |
12426 | 361 $ echo b > ib1/b |
362 $ hg --cwd ib1 ci -Am onsecond | |
363 adding b | |
364 $ hg --cwd ib1 branch -f default | |
365 marked working directory as branch default | |
15615 | 366 (branches are permanent and global, did you want a bookmark?) |
12426 | 367 $ echo c > ib1/c |
368 $ hg --cwd ib1 ci -Am newdefault | |
369 adding c | |
370 created new head | |
371 $ hg clone ib1 ib2 | |
372 updating to branch default | |
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
374 | |
375 fetch should succeed | |
376 | |
377 $ hg --cwd ib2 fetch ../ib1 | |
378 pulling from ../ib1 | |
379 searching for changes | |
380 no changes found | |
381 $ rm -fr ib1 ib2 | |
382 | |
383 test issue1726 | |
9093
0b2b269ba3d0
branch heads: fix regression introduced in e67e5b60e55f (issue1726)
Henrik Stuart <hg@hstuart.dk>
parents:
7855
diff
changeset
|
384 |
12426 | 385 $ hg init i1726r1 |
386 $ echo a > i1726r1/a | |
387 $ hg --cwd i1726r1 ci -Am base | |
388 adding a | |
389 $ hg clone i1726r1 i1726r2 | |
390 updating to branch default | |
391 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
392 $ echo b > i1726r1/a | |
393 $ hg --cwd i1726r1 ci -m second | |
394 $ echo c > i1726r2/a | |
395 $ hg --cwd i1726r2 ci -m third | |
396 $ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | |
397 pulling from ../i1726r1 | |
398 searching for changes | |
399 adding changesets | |
400 adding manifests | |
401 adding file changes | |
402 added 1 changesets with 1 changes to 1 files (+1 heads) | |
403 updating to 2:7837755a2789 | |
404 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
405 merging with 1:d1f0c6c48ebd | |
406 merging a | |
407 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
408 new changeset 3:* merges remote changes with local (glob) | |
409 $ hg --cwd i1726r2 heads default --template '{rev}\n' | |
410 3 | |
10580
612c142b7a82
fetch: fix newheads calculation (issue2047)
Sune Foldager <cryo@cyanite.org>
parents:
10398
diff
changeset
|
411 |
12426 | 412 test issue2047 |
7344
58fd3c718ca4
tests: add killdaemons helper script
Matt Mackall <mpm@selenic.com>
parents:
7049
diff
changeset
|
413 |
12426 | 414 $ hg -q init i2047a |
415 $ cd i2047a | |
416 $ echo a > a | |
417 $ hg -q ci -Am a | |
418 $ hg -q branch stable | |
419 $ echo b > b | |
420 $ hg -q ci -Am b | |
421 $ cd .. | |
422 $ hg -q clone -r 0 i2047a i2047b | |
423 $ cd i2047b | |
424 $ hg fetch ../i2047a | |
425 pulling from ../i2047a | |
426 searching for changes | |
427 adding changesets | |
428 adding manifests | |
429 adding file changes | |
430 added 1 changesets with 1 changes to 1 files | |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
431 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
432 $ cd .. |