Show More
@@ -0,0 +1,43 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | cat <<EOF >> $HGRCPATH | |
|
4 | [extensions] | |
|
5 | notify= | |
|
6 | ||
|
7 | [hooks] | |
|
8 | changegroup.notify = python:hgext.notify.hook | |
|
9 | ||
|
10 | [notify] | |
|
11 | sources = push | |
|
12 | diffstat = False | |
|
13 | maxsubject = 200 | |
|
14 | ||
|
15 | [usersubs] | |
|
16 | foo@bar = * | |
|
17 | ||
|
18 | [reposubs] | |
|
19 | * = baz | |
|
20 | EOF | |
|
21 | ||
|
22 | hg init a | |
|
23 | ||
|
24 | echo % clone | |
|
25 | hg --traceback clone a b | |
|
26 | ||
|
27 | echo a > b/a | |
|
28 | echo % commit | |
|
29 | hg --traceback --cwd b commit -Ama | |
|
30 | ||
|
31 | echo a >> b/a | |
|
32 | echo % commit | |
|
33 | hg --traceback --cwd b commit -Amb | |
|
34 | ||
|
35 | echo % push | |
|
36 | hg --traceback --cwd b push ../a 2>&1 | | |
|
37 | python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' | | |
|
38 | sed -e 's/\(Message-Id:\).*/\1/' \ | |
|
39 | -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \ | |
|
40 | -e 's/^Subject: .*test-notify/Subject: test-notify/' \ | |
|
41 | -e 's/^details: .*test-notify/details: test-notify/' \ | |
|
42 | -e 's/^Date:.*/Date:/' | |
|
43 |
@@ -0,0 +1,36 b'' | |||
|
1 | % clone | |
|
2 | updating working directory | |
|
3 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
4 | % commit | |
|
5 | adding a | |
|
6 | % commit | |
|
7 | % push | |
|
8 | pushing to ../a | |
|
9 | searching for changes | |
|
10 | adding changesets | |
|
11 | adding manifests | |
|
12 | adding file changes | |
|
13 | added 2 changesets with 2 changes to 1 files | |
|
14 | Date: | |
|
15 | Subject: test-notify-changegroup/a: 2 new changesets | |
|
16 | From: test | |
|
17 | X-Hg-Notification: changeset cb9a9f314b8b | |
|
18 | Message-Id: | |
|
19 | To: baz, foo@bar | |
|
20 | ||
|
21 | changeset cb9a9f314b8b in test-notify-changegroup/a | |
|
22 | details: test-notify-changegroup/a?cmd=changeset;node=cb9a9f314b8b | |
|
23 | summary: a | |
|
24 | ||
|
25 | changeset ba677d0156c1 in test-notify-changegroup/a | |
|
26 | details: test-notify-changegroup/a?cmd=changeset;node=ba677d0156c1 | |
|
27 | summary: b | |
|
28 | ||
|
29 | diffs (6 lines): | |
|
30 | ||
|
31 | diff -r 000000000000 -r ba677d0156c1 a | |
|
32 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
|
33 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
|
34 | @@ -0,0 +1,2 @@ | |
|
35 | +a | |
|
36 | +a |
@@ -1,286 +1,287 b'' | |||
|
1 | 1 | # hg.py - repository classes for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms |
|
7 | 7 | # of the GNU General Public License, incorporated herein by reference. |
|
8 | 8 | |
|
9 | 9 | from i18n import _ |
|
10 | 10 | import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo |
|
11 | 11 | import errno, lock, os, shutil, util, extensions |
|
12 | 12 | import merge as _merge |
|
13 | 13 | import verify as _verify |
|
14 | 14 | |
|
15 | 15 | def _local(path): |
|
16 | 16 | return (os.path.isfile(util.drop_scheme('file', path)) and |
|
17 | 17 | bundlerepo or localrepo) |
|
18 | 18 | |
|
19 | 19 | def parseurl(url, revs=[]): |
|
20 | 20 | '''parse url#branch, returning url, branch + revs''' |
|
21 | 21 | |
|
22 | 22 | if '#' not in url: |
|
23 | 23 | return url, (revs or None), None |
|
24 | 24 | |
|
25 | 25 | url, rev = url.split('#', 1) |
|
26 | 26 | return url, revs + [rev], rev |
|
27 | 27 | |
|
28 | 28 | schemes = { |
|
29 | 29 | 'bundle': bundlerepo, |
|
30 | 30 | 'file': _local, |
|
31 | 31 | 'http': httprepo, |
|
32 | 32 | 'https': httprepo, |
|
33 | 33 | 'ssh': sshrepo, |
|
34 | 34 | 'static-http': statichttprepo, |
|
35 | 35 | } |
|
36 | 36 | |
|
37 | 37 | def _lookup(path): |
|
38 | 38 | scheme = 'file' |
|
39 | 39 | if path: |
|
40 | 40 | c = path.find(':') |
|
41 | 41 | if c > 0: |
|
42 | 42 | scheme = path[:c] |
|
43 | 43 | thing = schemes.get(scheme) or schemes['file'] |
|
44 | 44 | try: |
|
45 | 45 | return thing(path) |
|
46 | 46 | except TypeError: |
|
47 | 47 | return thing |
|
48 | 48 | |
|
49 | 49 | def islocal(repo): |
|
50 | 50 | '''return true if repo or path is local''' |
|
51 | 51 | if isinstance(repo, str): |
|
52 | 52 | try: |
|
53 | 53 | return _lookup(repo).islocal(repo) |
|
54 | 54 | except AttributeError: |
|
55 | 55 | return False |
|
56 | 56 | return repo.local() |
|
57 | 57 | |
|
58 | 58 | def repository(ui, path='', create=False): |
|
59 | 59 | """return a repository object for the specified path""" |
|
60 | 60 | repo = _lookup(path).instance(ui, path, create) |
|
61 | 61 | ui = getattr(repo, "ui", ui) |
|
62 | 62 | for name, module in extensions.extensions(): |
|
63 | 63 | hook = getattr(module, 'reposetup', None) |
|
64 | 64 | if hook: |
|
65 | 65 | hook(ui, repo) |
|
66 | 66 | return repo |
|
67 | 67 | |
|
68 | 68 | def defaultdest(source): |
|
69 | 69 | '''return default destination of clone if none is given''' |
|
70 | 70 | return os.path.basename(os.path.normpath(source)) |
|
71 | 71 | |
|
72 | 72 | def localpath(path): |
|
73 | 73 | if path.startswith('file://localhost/'): |
|
74 | 74 | return path[16:] |
|
75 | 75 | if path.startswith('file://'): |
|
76 | 76 | return path[7:] |
|
77 | 77 | if path.startswith('file:'): |
|
78 | 78 | return path[5:] |
|
79 | 79 | return path |
|
80 | 80 | |
|
81 | 81 | def clone(ui, source, dest=None, pull=False, rev=None, update=True, |
|
82 | 82 | stream=False): |
|
83 | 83 | """Make a copy of an existing repository. |
|
84 | 84 | |
|
85 | 85 | Create a copy of an existing repository in a new directory. The |
|
86 | 86 | source and destination are URLs, as passed to the repository |
|
87 | 87 | function. Returns a pair of repository objects, the source and |
|
88 | 88 | newly created destination. |
|
89 | 89 | |
|
90 | 90 | The location of the source is added to the new repository's |
|
91 | 91 | .hg/hgrc file, as the default to be used for future pulls and |
|
92 | 92 | pushes. |
|
93 | 93 | |
|
94 | 94 | If an exception is raised, the partly cloned/updated destination |
|
95 | 95 | repository will be deleted. |
|
96 | 96 | |
|
97 | 97 | Arguments: |
|
98 | 98 | |
|
99 | 99 | source: repository object or URL |
|
100 | 100 | |
|
101 | 101 | dest: URL of destination repository to create (defaults to base |
|
102 | 102 | name of source repository) |
|
103 | 103 | |
|
104 | 104 | pull: always pull from source repository, even in local case |
|
105 | 105 | |
|
106 | 106 | stream: stream raw data uncompressed from repository (fast over |
|
107 | 107 | LAN, slow over WAN) |
|
108 | 108 | |
|
109 | 109 | rev: revision to clone up to (implies pull=True) |
|
110 | 110 | |
|
111 | 111 | update: update working directory after clone completes, if |
|
112 | 112 | destination is local repository (True means update to default rev, |
|
113 | 113 | anything else is treated as a revision) |
|
114 | 114 | """ |
|
115 | 115 | |
|
116 | 116 | if isinstance(source, str): |
|
117 | 117 | origsource = ui.expandpath(source) |
|
118 | 118 | source, rev, checkout = parseurl(origsource, rev) |
|
119 | 119 | src_repo = repository(ui, source) |
|
120 | 120 | else: |
|
121 | 121 | src_repo = source |
|
122 | 122 | origsource = source = src_repo.url() |
|
123 | 123 | checkout = None |
|
124 | 124 | |
|
125 | 125 | if dest is None: |
|
126 | 126 | dest = defaultdest(source) |
|
127 | 127 | ui.status(_("destination directory: %s\n") % dest) |
|
128 | 128 | |
|
129 | 129 | dest = localpath(dest) |
|
130 | 130 | source = localpath(source) |
|
131 | 131 | |
|
132 | 132 | if os.path.exists(dest): |
|
133 | 133 | raise util.Abort(_("destination '%s' already exists") % dest) |
|
134 | 134 | |
|
135 | 135 | class DirCleanup(object): |
|
136 | 136 | def __init__(self, dir_): |
|
137 | 137 | self.rmtree = shutil.rmtree |
|
138 | 138 | self.dir_ = dir_ |
|
139 | 139 | def close(self): |
|
140 | 140 | self.dir_ = None |
|
141 | 141 | def __del__(self): |
|
142 | 142 | if self.dir_: |
|
143 | 143 | self.rmtree(self.dir_, True) |
|
144 | 144 | |
|
145 | 145 | src_lock = dest_lock = dir_cleanup = None |
|
146 | 146 | try: |
|
147 | 147 | if islocal(dest): |
|
148 | 148 | dir_cleanup = DirCleanup(dest) |
|
149 | 149 | |
|
150 | 150 | abspath = origsource |
|
151 | 151 | copy = False |
|
152 | 152 | if src_repo.cancopy() and islocal(dest): |
|
153 | 153 | abspath = os.path.abspath(util.drop_scheme('file', origsource)) |
|
154 | 154 | copy = not pull and not rev |
|
155 | 155 | |
|
156 | 156 | if copy: |
|
157 | 157 | try: |
|
158 | 158 | # we use a lock here because if we race with commit, we |
|
159 | 159 | # can end up with extra data in the cloned revlogs that's |
|
160 | 160 | # not pointed to by changesets, thus causing verify to |
|
161 | 161 | # fail |
|
162 | 162 | src_lock = src_repo.lock() |
|
163 | 163 | except lock.LockException: |
|
164 | 164 | copy = False |
|
165 | 165 | |
|
166 | 166 | if copy: |
|
167 | 167 | if not os.path.exists(dest): |
|
168 | 168 | os.mkdir(dest) |
|
169 | 169 | try: |
|
170 | 170 | dest_path = os.path.realpath(os.path.join(dest, ".hg")) |
|
171 | 171 | os.mkdir(dest_path) |
|
172 | 172 | except OSError, inst: |
|
173 | 173 | if inst.errno == errno.EEXIST: |
|
174 | 174 | dir_cleanup.close() |
|
175 | 175 | raise util.Abort(_("destination '%s' already exists") |
|
176 | 176 | % dest) |
|
177 | 177 | raise |
|
178 | 178 | |
|
179 | 179 | for f in src_repo.store.copylist(): |
|
180 | 180 | src = os.path.join(src_repo.path, f) |
|
181 | 181 | dst = os.path.join(dest_path, f) |
|
182 | 182 | dstbase = os.path.dirname(dst) |
|
183 | 183 | if dstbase and not os.path.exists(dstbase): |
|
184 | 184 | os.mkdir(dstbase) |
|
185 | 185 | if os.path.exists(src): |
|
186 | 186 | if dst.endswith('data'): |
|
187 | 187 | # lock to avoid premature writing to the target |
|
188 | 188 | dest_lock = lock.lock(os.path.join(dstbase, "lock")) |
|
189 | 189 | util.copyfiles(src, dst) |
|
190 | 190 | |
|
191 | 191 | # we need to re-init the repo after manually copying the data |
|
192 | 192 | # into it |
|
193 | 193 | dest_repo = repository(ui, dest) |
|
194 | 194 | |
|
195 | 195 | else: |
|
196 | 196 | try: |
|
197 | 197 | dest_repo = repository(ui, dest, create=True) |
|
198 | 198 | except OSError, inst: |
|
199 | 199 | if inst.errno == errno.EEXIST: |
|
200 | 200 | dir_cleanup.close() |
|
201 | 201 | raise util.Abort(_("destination '%s' already exists") |
|
202 | 202 | % dest) |
|
203 | 203 | raise |
|
204 | 204 | |
|
205 | 205 | revs = None |
|
206 | 206 | if rev: |
|
207 | 207 | if 'lookup' not in src_repo.capabilities: |
|
208 | 208 | raise util.Abort(_("src repository does not support revision " |
|
209 | 209 | "lookup and so doesn't support clone by " |
|
210 | 210 | "revision")) |
|
211 | 211 | revs = [src_repo.lookup(r) for r in rev] |
|
212 | 212 | |
|
213 | 213 | if dest_repo.local(): |
|
214 | 214 | dest_repo.clone(src_repo, heads=revs, stream=stream) |
|
215 | 215 | elif src_repo.local(): |
|
216 | 216 | src_repo.push(dest_repo, revs=revs) |
|
217 | 217 | else: |
|
218 | 218 | raise util.Abort(_("clone from remote to remote not supported")) |
|
219 | 219 | |
|
220 | 220 | if dir_cleanup: |
|
221 | 221 | dir_cleanup.close() |
|
222 | 222 | |
|
223 | 223 | if dest_repo.local(): |
|
224 | 224 | fp = dest_repo.opener("hgrc", "w", text=True) |
|
225 | 225 | fp.write("[paths]\n") |
|
226 | fp.write("default = %s\n" % abspath) | |
|
226 | # percent needs to be escaped for ConfigParser | |
|
227 | fp.write("default = %s\n" % abspath.replace('%', '%%')) | |
|
227 | 228 | fp.close() |
|
228 | 229 | |
|
229 | 230 | if update: |
|
230 | 231 | dest_repo.ui.status(_("updating working directory\n")) |
|
231 | 232 | if update is not True: |
|
232 | 233 | checkout = update |
|
233 | 234 | elif not checkout: |
|
234 | 235 | try: |
|
235 | 236 | checkout = dest_repo.lookup("default") |
|
236 | 237 | except: |
|
237 | 238 | checkout = dest_repo.changelog.tip() |
|
238 | 239 | _update(dest_repo, checkout) |
|
239 | 240 | |
|
240 | 241 | return src_repo, dest_repo |
|
241 | 242 | finally: |
|
242 | 243 | del src_lock, dest_lock, dir_cleanup |
|
243 | 244 | |
|
244 | 245 | def _showstats(repo, stats): |
|
245 | 246 | stats = ((stats[0], _("updated")), |
|
246 | 247 | (stats[1], _("merged")), |
|
247 | 248 | (stats[2], _("removed")), |
|
248 | 249 | (stats[3], _("unresolved"))) |
|
249 | 250 | note = ", ".join([_("%d files %s") % s for s in stats]) |
|
250 | 251 | repo.ui.status("%s\n" % note) |
|
251 | 252 | |
|
252 | 253 | def _update(repo, node): return update(repo, node) |
|
253 | 254 | |
|
254 | 255 | def update(repo, node): |
|
255 | 256 | """update the working directory to node, merging linear changes""" |
|
256 | 257 | pl = repo.parents() |
|
257 | 258 | stats = _merge.update(repo, node, False, False, None) |
|
258 | 259 | _showstats(repo, stats) |
|
259 | 260 | if stats[3]: |
|
260 | 261 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
|
261 | 262 | return stats[3] > 0 |
|
262 | 263 | |
|
263 | 264 | def clean(repo, node, show_stats=True): |
|
264 | 265 | """forcibly switch the working directory to node, clobbering changes""" |
|
265 | 266 | stats = _merge.update(repo, node, False, True, None) |
|
266 | 267 | if show_stats: _showstats(repo, stats) |
|
267 | 268 | return stats[3] > 0 |
|
268 | 269 | |
|
269 | 270 | def merge(repo, node, force=None, remind=True): |
|
270 | 271 | """branch merge with node, resolving changes""" |
|
271 | 272 | stats = _merge.update(repo, node, True, force, False) |
|
272 | 273 | _showstats(repo, stats) |
|
273 | 274 | if stats[3]: |
|
274 | 275 | pl = repo.parents() |
|
275 | 276 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
|
276 | 277 | elif remind: |
|
277 | 278 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
|
278 | 279 | return stats[3] > 0 |
|
279 | 280 | |
|
280 | 281 | def revert(repo, node, choose): |
|
281 | 282 | """revert changes to revision in node without updating dirstate""" |
|
282 | 283 | return _merge.update(repo, node, False, True, choose)[3] > 0 |
|
283 | 284 | |
|
284 | 285 | def verify(repo): |
|
285 | 286 | """verify the consistency of a repository""" |
|
286 | 287 | return _verify.verify(repo) |
@@ -1,12 +1,14 b'' | |||
|
1 | # this is hack to make sure no escape characters are inserted into the output | |
|
2 | import os; del os.environ['TERM'] | |
|
1 | 3 | import doctest |
|
2 | 4 | |
|
3 | 5 | import mercurial.changelog |
|
4 | 6 | # test doctest from changelog |
|
5 | 7 | |
|
6 | 8 | doctest.testmod(mercurial.changelog) |
|
7 | 9 | |
|
8 | 10 | import mercurial.httprepo |
|
9 | 11 | doctest.testmod(mercurial.httprepo) |
|
10 | 12 | |
|
11 | 13 | import mercurial.util |
|
12 | 14 | doctest.testmod(mercurial.util) |
@@ -1,7 +1,18 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | mkdir t |
|
4 | 4 | cd t |
|
5 | 5 | hg init |
|
6 | 6 | echo "invalid" > .hg/hgrc |
|
7 | 7 | hg status 2>&1 |sed -e "s:/.*\(/t/.*\):...\1:" |
|
8 | ||
|
9 | #issue 1199, escaping | |
|
10 | ||
|
11 | cd .. | |
|
12 | hg init "foo%bar" | |
|
13 | hg clone "foo%bar" foobar | |
|
14 | p=`pwd` | |
|
15 | cd foobar | |
|
16 | cat .hg/hgrc |sed -e "s:$p:...:" | |
|
17 | hg paths |sed -e "s:$p:...:" | |
|
18 | hg showconfig |sed -e "s:$p:...:" |
@@ -1,4 +1,16 b'' | |||
|
1 | 1 | abort: Failed to parse .../t/.hg/hgrc |
|
2 | 2 | File contains no section headers. |
|
3 | 3 | file: .../t/.hg/hgrc, line: 1 |
|
4 | 4 | 'invalid\n' |
|
5 | updating working directory | |
|
6 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
7 | [paths] | |
|
8 | default = .../foo%%bar | |
|
9 | default = .../foo%bar | |
|
10 | bundle.mainreporoot=.../foobar | |
|
11 | defaults.backout=-d "0 0" | |
|
12 | defaults.commit=-d "0 0" | |
|
13 | defaults.debugrawcommit=-d "0 0" | |
|
14 | defaults.tag=-d "0 0" | |
|
15 | paths.default=.../foo%bar | |
|
16 | ui.slash=True |
@@ -1,539 +1,539 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | checkundo() |
|
4 | 4 | { |
|
5 | 5 | if [ -f .hg/store/undo ]; then |
|
6 | 6 | echo ".hg/store/undo still exists after $1" |
|
7 | 7 | fi |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | 10 | echo "[extensions]" >> $HGRCPATH |
|
11 | 11 | echo "mq=" >> $HGRCPATH |
|
12 | 12 | |
|
13 | 13 | echo % help |
|
14 | 14 | hg help mq |
|
15 | 15 | |
|
16 | 16 | hg init a |
|
17 | 17 | cd a |
|
18 | 18 | echo a > a |
|
19 | 19 | hg ci -Ama |
|
20 | 20 | |
|
21 | 21 | hg clone . ../k |
|
22 | 22 | |
|
23 | 23 | mkdir b |
|
24 | 24 | echo z > b/z |
|
25 | 25 | hg ci -Ama |
|
26 | 26 | |
|
27 | 27 | echo % qinit |
|
28 | 28 | |
|
29 | 29 | hg qinit |
|
30 | 30 | |
|
31 | 31 | cd .. |
|
32 | 32 | hg init b |
|
33 | 33 | |
|
34 | 34 | echo % -R qinit |
|
35 | 35 | |
|
36 | 36 | hg -R b qinit |
|
37 | 37 | |
|
38 | 38 | hg init c |
|
39 | 39 | |
|
40 | 40 | echo % qinit -c |
|
41 | 41 | |
|
42 | 42 | hg --cwd c qinit -c |
|
43 | 43 | hg -R c/.hg/patches st |
|
44 | 44 | |
|
45 | 45 | echo % qnew should refuse bad patch names |
|
46 | 46 | hg -R c qnew series |
|
47 | 47 | hg -R c qnew status |
|
48 | 48 | hg -R c qnew guards |
|
49 | 49 | hg -R c qnew .hgignore |
|
50 | 50 | |
|
51 | 51 | echo % qnew implies add |
|
52 | 52 | |
|
53 | 53 | hg -R c qnew test.patch |
|
54 | 54 | hg -R c/.hg/patches st |
|
55 | 55 | |
|
56 | 56 | echo '% qinit; qinit -c' |
|
57 | 57 | hg init d |
|
58 | 58 | cd d |
|
59 | 59 | hg qinit |
|
60 | 60 | hg qinit -c |
|
61 | 61 | # qinit -c should create both files if they don't exist |
|
62 | 62 | echo ' .hgignore:' |
|
63 | 63 | cat .hg/patches/.hgignore |
|
64 | 64 | echo ' series:' |
|
65 | 65 | cat .hg/patches/series |
|
66 | 66 | hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/' |
|
67 | 67 | cd .. |
|
68 | 68 | |
|
69 | 69 | echo '% qinit; <stuff>; qinit -c' |
|
70 | 70 | hg init e |
|
71 | 71 | cd e |
|
72 | 72 | hg qnew A |
|
73 | 73 | checkundo qnew |
|
74 | 74 | echo foo > foo |
|
75 | 75 | hg add foo |
|
76 | 76 | hg qrefresh |
|
77 | 77 | hg qnew B |
|
78 | 78 | echo >> foo |
|
79 | 79 | hg qrefresh |
|
80 | 80 | echo status >> .hg/patches/.hgignore |
|
81 | 81 | echo bleh >> .hg/patches/.hgignore |
|
82 | 82 | hg qinit -c |
|
83 | 83 | hg -R .hg/patches status |
|
84 | 84 | # qinit -c shouldn't touch these files if they already exist |
|
85 | 85 | echo ' .hgignore:' |
|
86 | 86 | cat .hg/patches/.hgignore |
|
87 | 87 | echo ' series:' |
|
88 | 88 | cat .hg/patches/series |
|
89 | 89 | cd .. |
|
90 | 90 | |
|
91 | 91 | cd a |
|
92 | 92 | |
|
93 | 93 | echo a > somefile |
|
94 | 94 | hg add somefile |
|
95 | 95 | |
|
96 | 96 | echo % qnew with uncommitted changes |
|
97 | 97 | |
|
98 | 98 | hg qnew uncommitted.patch |
|
99 | 99 | hg st |
|
100 | 100 | hg qseries |
|
101 | 101 | |
|
102 | 102 | echo '% qnew with uncommitted changes and missing file (issue 803)' |
|
103 | 103 | |
|
104 | 104 | hg qnew issue803.patch someotherfile 2>&1 | \ |
|
105 | 105 | sed -e 's/someotherfile:.*/someotherfile: No such file or directory/' |
|
106 | 106 | hg st |
|
107 | 107 | hg qseries |
|
108 | 108 | hg qpop -f |
|
109 | 109 | hg qdel issue803.patch |
|
110 | 110 | |
|
111 | 111 | hg revert --no-backup somefile |
|
112 | 112 | rm somefile |
|
113 | 113 | |
|
114 | 114 | echo % qnew -m |
|
115 | 115 | |
|
116 | 116 | hg qnew -m 'foo bar' test.patch |
|
117 | 117 | cat .hg/patches/test.patch |
|
118 | 118 | |
|
119 | 119 | echo % qrefresh |
|
120 | 120 | |
|
121 | 121 | echo a >> a |
|
122 | 122 | hg qrefresh |
|
123 | 123 | sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \ |
|
124 | 124 | -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
125 | 125 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch |
|
126 | 126 | |
|
127 | 127 | echo % empty qrefresh |
|
128 | 128 | |
|
129 | 129 | hg qrefresh -X a |
|
130 | 130 | echo 'revision:' |
|
131 | 131 | hg diff -r -2 -r -1 |
|
132 | 132 | echo 'patch:' |
|
133 | 133 | cat .hg/patches/test.patch |
|
134 | 134 | echo 'working dir diff:' |
|
135 | 135 | hg diff --nodates -q |
|
136 | 136 | # restore things |
|
137 | 137 | hg qrefresh |
|
138 | 138 | checkundo qrefresh |
|
139 | 139 | |
|
140 | 140 | echo % qpop |
|
141 | 141 | |
|
142 | 142 | hg qpop |
|
143 | 143 | checkundo qpop |
|
144 | 144 | |
|
145 | 145 | echo % qpush |
|
146 | 146 | |
|
147 | 147 | hg qpush |
|
148 | 148 | checkundo qpush |
|
149 | 149 | |
|
150 | 150 | cd .. |
|
151 | 151 | |
|
152 | 152 | echo % pop/push outside repo |
|
153 | 153 | |
|
154 | 154 | hg -R a qpop |
|
155 | 155 | hg -R a qpush |
|
156 | 156 | |
|
157 | 157 | cd a |
|
158 | 158 | hg qnew test2.patch |
|
159 | 159 | |
|
160 | 160 | echo % qrefresh in subdir |
|
161 | 161 | |
|
162 | 162 | cd b |
|
163 | 163 | echo a > a |
|
164 | 164 | hg add a |
|
165 | 165 | hg qrefresh |
|
166 | 166 | |
|
167 | 167 | echo % pop/push -a in subdir |
|
168 | 168 | |
|
169 | 169 | hg qpop -a |
|
170 | 170 | hg --traceback qpush -a |
|
171 | 171 | |
|
172 | 172 | echo % qseries |
|
173 | 173 | hg qseries |
|
174 | 174 | hg qpop |
|
175 | 175 | hg qseries -vs |
|
176 | 176 | hg qpush |
|
177 | 177 | |
|
178 | 178 | echo % qapplied |
|
179 | 179 | hg qapplied |
|
180 | 180 | |
|
181 | 181 | echo % qtop |
|
182 | 182 | hg qtop |
|
183 | 183 | |
|
184 | 184 | echo % qprev |
|
185 | 185 | hg qprev |
|
186 | 186 | |
|
187 | 187 | echo % qnext |
|
188 | 188 | hg qnext |
|
189 | 189 | |
|
190 | 190 | echo % pop, qnext, qprev, qapplied |
|
191 | 191 | hg qpop |
|
192 | 192 | hg qnext |
|
193 | 193 | hg qprev |
|
194 | 194 | hg qapplied |
|
195 | 195 | |
|
196 | 196 | echo % commit should fail |
|
197 | 197 | hg commit |
|
198 | 198 | |
|
199 | 199 | echo % push should fail |
|
200 | 200 | hg push ../../k |
|
201 | 201 | |
|
202 | 202 | echo % qunapplied |
|
203 | 203 | hg qunapplied |
|
204 | 204 | |
|
205 | 205 | echo % qpush/qpop with index |
|
206 | 206 | hg qnew test1b.patch |
|
207 | 207 | echo 1b > 1b |
|
208 | 208 | hg add 1b |
|
209 | 209 | hg qrefresh |
|
210 | 210 | hg qpush 2 |
|
211 | 211 | hg qpop 0 |
|
212 | 212 | hg qpush test.patch+1 |
|
213 | 213 | hg qpush test.patch+2 |
|
214 | 214 | hg qpop test2.patch-1 |
|
215 | 215 | hg qpop test2.patch-2 |
|
216 | 216 | hg qpush test1b.patch+1 |
|
217 | 217 | |
|
218 | 218 | echo % push should succeed |
|
219 | 219 | hg qpop -a |
|
220 | 220 | hg push ../../k |
|
221 | 221 | |
|
222 | 222 | echo % qpush/qpop error codes |
|
223 | 223 | errorcode() |
|
224 | 224 | { |
|
225 | 225 | hg "$@" && echo " $@ succeeds" || echo " $@ fails" |
|
226 | 226 | } |
|
227 | 227 | |
|
228 | 228 | # we want to start with some patches applied |
|
229 | 229 | hg qpush -a |
|
230 | 230 | echo " % pops all patches and succeeds" |
|
231 | 231 | errorcode qpop -a |
|
232 | 232 | echo " % does nothing and succeeds" |
|
233 | 233 | errorcode qpop -a |
|
234 | 234 | echo " % fails - nothing else to pop" |
|
235 | 235 | errorcode qpop |
|
236 | 236 | echo " % pushes a patch and succeeds" |
|
237 | 237 | errorcode qpush |
|
238 | 238 | echo " % pops a patch and succeeds" |
|
239 | 239 | errorcode qpop |
|
240 | 240 | echo " % pushes up to test1b.patch and succeeds" |
|
241 | 241 | errorcode qpush test1b.patch |
|
242 | 242 | echo " % does nothing and succeeds" |
|
243 | 243 | errorcode qpush test1b.patch |
|
244 | 244 | echo " % does nothing and succeeds" |
|
245 | 245 | errorcode qpop test1b.patch |
|
246 | 246 | echo " % fails - can't push to this patch" |
|
247 | 247 | errorcode qpush test.patch |
|
248 | 248 | echo " % fails - can't pop to this patch" |
|
249 | 249 | errorcode qpop test2.patch |
|
250 | 250 | echo " % pops up to test.patch and succeeds" |
|
251 | 251 | errorcode qpop test.patch |
|
252 | 252 | echo " % pushes all patches and succeeds" |
|
253 | 253 | errorcode qpush -a |
|
254 | 254 | echo " % does nothing and succeeds" |
|
255 | 255 | errorcode qpush -a |
|
256 | 256 | echo " % fails - nothing else to push" |
|
257 | 257 | errorcode qpush |
|
258 | 258 | echo " % does nothing and succeeds" |
|
259 | 259 | errorcode qpush test2.patch |
|
260 | 260 | |
|
261 | 261 | |
|
262 | 262 | echo % strip |
|
263 | 263 | cd ../../b |
|
264 | 264 | echo x>x |
|
265 | 265 | hg ci -Ama |
|
266 | 266 | hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
267 | 267 | hg unbundle .hg/strip-backup/* |
|
268 | 268 | |
|
269 | 269 | echo % strip with local changes, should complain |
|
270 | 270 | hg up |
|
271 | 271 | echo y>y |
|
272 | 272 | hg add y |
|
273 | 273 | hg strip tip | sed 's/\(saving bundle to \).*/\1/' |
|
274 | 274 | echo % --force strip with local changes |
|
275 | 275 | hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
276 | 276 | |
|
277 | 277 | echo '% cd b; hg qrefresh' |
|
278 | 278 | hg init refresh |
|
279 | 279 | cd refresh |
|
280 | 280 | echo a > a |
|
281 | 281 | hg ci -Ama -d'0 0' |
|
282 | 282 | hg qnew -mfoo foo |
|
283 | 283 | echo a >> a |
|
284 | 284 | hg qrefresh |
|
285 | 285 | mkdir b |
|
286 | 286 | cd b |
|
287 | 287 | echo f > f |
|
288 | 288 | hg add f |
|
289 | 289 | hg qrefresh |
|
290 | 290 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
291 | 291 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo |
|
292 | 292 | echo % hg qrefresh . |
|
293 | 293 | hg qrefresh . |
|
294 | 294 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
295 | 295 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo |
|
296 | 296 | hg status |
|
297 | 297 | |
|
298 | 298 | echo % qpush failure |
|
299 | 299 | cd .. |
|
300 | 300 | hg qrefresh |
|
301 | 301 | hg qnew -mbar bar |
|
302 | 302 | echo foo > foo |
|
303 | 303 | echo bar > bar |
|
304 | 304 | hg add foo bar |
|
305 | 305 | hg qrefresh |
|
306 | 306 | hg qpop -a |
|
307 | 307 | echo bar > foo |
|
308 | 308 | hg qpush -a |
|
309 | 309 | hg st |
|
310 | 310 | |
|
311 | 311 | echo % mq tags |
|
312 | 312 | hg log --template '{rev} {tags}\n' -r qparent:qtip |
|
313 | 313 | |
|
314 | 314 | echo % bad node in status |
|
315 | 315 | hg qpop |
|
316 | 316 | hg strip -qn tip |
|
317 | 317 | hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/' |
|
318 | 318 | hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/' |
|
319 | 319 | hg qpop |
|
320 | 320 | |
|
321 | 321 | cat >>$HGRCPATH <<EOF |
|
322 | 322 | [diff] |
|
323 | 323 | git = True |
|
324 | 324 | EOF |
|
325 | 325 | cd .. |
|
326 | 326 | hg init git |
|
327 | 327 | cd git |
|
328 | 328 | hg qinit |
|
329 | 329 | |
|
330 | 330 | hg qnew -m'new file' new |
|
331 | 331 | echo foo > new |
|
332 | 332 | chmod +x new |
|
333 | 333 | hg add new |
|
334 | 334 | hg qrefresh |
|
335 | 335 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
336 | 336 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new |
|
337 | 337 | |
|
338 | 338 | hg qnew -m'copy file' copy |
|
339 | 339 | hg cp new copy |
|
340 | 340 | hg qrefresh |
|
341 | 341 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
342 | 342 | -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy |
|
343 | 343 | |
|
344 | 344 | hg qpop |
|
345 | 345 | hg qpush |
|
346 | 346 | hg qdiff |
|
347 | 347 | cat >>$HGRCPATH <<EOF |
|
348 | 348 | [diff] |
|
349 | 349 | git = False |
|
350 | 350 | EOF |
|
351 | 351 | hg qdiff --git |
|
352 | 352 | |
|
353 | 353 | cd .. |
|
354 | 354 | hg init slow |
|
355 | 355 | cd slow |
|
356 | 356 | hg qinit |
|
357 | 357 | echo foo > foo |
|
358 | 358 | hg add foo |
|
359 | 359 | hg ci -m 'add foo' |
|
360 | 360 | hg qnew bar |
|
361 | 361 | echo bar > bar |
|
362 | 362 | hg add bar |
|
363 | 363 | hg mv foo baz |
|
364 | 364 | hg qrefresh --git |
|
365 | 365 | hg up -C 0 |
|
366 | 366 | echo >> foo |
|
367 | 367 | hg ci -m 'change foo' |
|
368 | 368 | hg up -C 1 |
|
369 | 369 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
370 | 370 | cat .hg/patches/bar |
|
371 | 371 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
372 | 372 | hg qrefresh --git |
|
373 | 373 | cat .hg/patches/bar |
|
374 | 374 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
375 | 375 | hg qrefresh |
|
376 | 376 | grep 'diff --git' .hg/patches/bar |
|
377 | 377 | |
|
378 | 378 | echo |
|
379 | 379 | hg up -C 1 |
|
380 | 380 | echo >> foo |
|
381 | 381 | hg ci -m 'change foo again' |
|
382 | 382 | hg up -C 2 |
|
383 | 383 | hg mv bar quux |
|
384 | 384 | hg mv baz bleh |
|
385 | 385 | hg qrefresh --git 2>&1 | grep -v 'saving bundle' |
|
386 | 386 | cat .hg/patches/bar |
|
387 | 387 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
388 | 388 | hg mv quux fred |
|
389 | 389 | hg mv bleh barney |
|
390 | 390 | hg qrefresh --git |
|
391 | 391 | cat .hg/patches/bar |
|
392 | 392 | hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . |
|
393 | 393 | |
|
394 | 394 | echo % refresh omitting an added file |
|
395 | 395 | hg qnew baz |
|
396 | 396 | echo newfile > newfile |
|
397 | 397 | hg add newfile |
|
398 | 398 | hg qrefresh |
|
399 | 399 | hg st -A newfile |
|
400 | 400 | hg qrefresh -X newfile |
|
401 | 401 | hg st -A newfile |
|
402 | 402 | hg revert newfile |
|
403 | 403 | rm newfile |
|
404 | 404 | hg qpop |
|
405 | 405 | hg qdel baz |
|
406 | 406 | |
|
407 | 407 | echo % create a git patch |
|
408 | 408 | echo a > alexander |
|
409 | 409 | hg add alexander |
|
410 | 410 | hg qnew -f --git addalexander |
|
411 | 411 | grep diff .hg/patches/addalexander |
|
412 | 412 | |
|
413 | 413 | echo % create a git binary patch |
|
414 | 414 | cat > writebin.py <<EOF |
|
415 | 415 | import sys |
|
416 | 416 | path = sys.argv[1] |
|
417 | 417 | open(path, 'wb').write('BIN\x00ARY') |
|
418 | 418 | EOF |
|
419 | 419 | python writebin.py bucephalus |
|
420 | 420 | |
|
421 | 421 | python "$TESTDIR/md5sum.py" bucephalus |
|
422 | 422 | hg add bucephalus |
|
423 | 423 | hg qnew -f --git addbucephalus |
|
424 | 424 | grep diff .hg/patches/addbucephalus |
|
425 | 425 | |
|
426 | 426 | echo % check binary patches can be popped and pushed |
|
427 | 427 | hg qpop |
|
428 | 428 | test -f bucephalus && echo % bucephalus should not be there |
|
429 | 429 | hg qpush |
|
430 | 430 | test -f bucephalus || echo % bucephalus should be there |
|
431 | 431 | python "$TESTDIR/md5sum.py" bucephalus |
|
432 | 432 | |
|
433 | 433 | |
|
434 | 434 | echo '% strip again' |
|
435 | 435 | cd .. |
|
436 | 436 | hg init strip |
|
437 | 437 | cd strip |
|
438 | 438 | touch foo |
|
439 | 439 | hg add foo |
|
440 | 440 | hg ci -m 'add foo' -d '0 0' |
|
441 | 441 | echo >> foo |
|
442 | 442 | hg ci -m 'change foo 1' -d '0 0' |
|
443 | 443 | hg up -C 0 |
|
444 | 444 | echo 1 >> foo |
|
445 | 445 | hg ci -m 'change foo 2' -d '0 0' |
|
446 | 446 | HGMERGE=true hg merge |
|
447 | 447 | hg ci -m merge -d '0 0' |
|
448 | 448 | hg log |
|
449 | 449 | hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' |
|
450 | 450 | checkundo strip |
|
451 | 451 | hg log |
|
452 | 452 | cd .. |
|
453 | 453 | |
|
454 | 454 | echo '% qclone' |
|
455 | 455 | qlog() |
|
456 | 456 | { |
|
457 | 457 | echo 'main repo:' |
|
458 | 458 | hg log --template ' rev {rev}: {desc}\n' |
|
459 | 459 | echo 'patch repo:' |
|
460 | 460 | hg -R .hg/patches log --template ' rev {rev}: {desc}\n' |
|
461 | 461 | } |
|
462 | 462 | hg init qclonesource |
|
463 | 463 | cd qclonesource |
|
464 | 464 | echo foo > foo |
|
465 | 465 | hg add foo |
|
466 | 466 | hg ci -m 'add foo' |
|
467 | 467 | hg qinit |
|
468 | 468 | hg qnew patch1 |
|
469 | 469 | echo bar >> foo |
|
470 | 470 | hg qrefresh -m 'change foo' |
|
471 | 471 | cd .. |
|
472 | 472 | |
|
473 | 473 | # repo with unversioned patch dir |
|
474 | 474 | hg qclone qclonesource failure |
|
475 | 475 | |
|
476 | 476 | cd qclonesource |
|
477 | 477 | hg qinit -c |
|
478 | 478 | hg qci -m checkpoint |
|
479 | 479 | qlog |
|
480 | 480 | cd .. |
|
481 | 481 | |
|
482 | 482 | # repo with patches applied |
|
483 | 483 | hg qclone qclonesource qclonedest |
|
484 | 484 | cd qclonedest |
|
485 | 485 | qlog |
|
486 | 486 | cd .. |
|
487 | 487 | |
|
488 | 488 | # repo with patches unapplied |
|
489 | 489 | cd qclonesource |
|
490 | 490 | hg qpop -a |
|
491 | 491 | qlog |
|
492 | 492 | cd .. |
|
493 | 493 | hg qclone qclonesource qclonedest2 |
|
494 | 494 | cd qclonedest2 |
|
495 | 495 | qlog |
|
496 | 496 | cd .. |
|
497 | 497 | |
|
498 | 498 | echo % 'test applying on an empty file (issue 1033)' |
|
499 | 499 | hg init empty |
|
500 | 500 | cd empty |
|
501 | 501 | touch a |
|
502 | 502 | hg ci -Am addempty |
|
503 | 503 | echo a > a |
|
504 | 504 | hg qnew -f -e changea |
|
505 | 505 | hg qpop |
|
506 | 506 | hg qpush |
|
507 | 507 | cd .. |
|
508 | 508 | |
|
509 | 509 | echo % test qpush with --force, issue1087 |
|
510 | 510 | hg init forcepush |
|
511 | 511 | cd forcepush |
|
512 | 512 | echo hello > hello.txt |
|
513 | 513 | echo bye > bye.txt |
|
514 | 514 | hg ci -Ama |
|
515 | 515 | hg qnew -d '0 0' empty |
|
516 | 516 | hg qpop |
|
517 | 517 | echo world >> hello.txt |
|
518 | 518 | |
|
519 | 519 | echo % qpush should fail, local changes |
|
520 | 520 | hg qpush |
|
521 | 521 | |
|
522 | 522 | echo % apply force, should not discard changes with empty patch |
|
523 | hg qpush -f | |
|
523 | hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g' | |
|
524 | 524 | hg diff --config diff.nodates=True |
|
525 | 525 | hg qdiff --config diff.nodates=True |
|
526 | 526 | hg log -l1 -p |
|
527 | 527 | hg qref -d '0 0' |
|
528 | 528 | hg qpop |
|
529 | 529 | echo universe >> hello.txt |
|
530 | 530 | echo universe >> bye.txt |
|
531 | 531 | |
|
532 | 532 | echo % qpush should fail, local changes |
|
533 | 533 | hg qpush |
|
534 | 534 | |
|
535 | 535 | echo % apply force, should discard changes in hello, but not bye |
|
536 | 536 | hg qpush -f |
|
537 | 537 | hg st |
|
538 | 538 | hg diff --config diff.nodates=True |
|
539 | 539 | hg qdiff --config diff.nodates=True |
@@ -1,554 +1,554 b'' | |||
|
1 | 1 | % help |
|
2 | 2 | mq extension - patch management and development |
|
3 | 3 | |
|
4 | 4 | This extension lets you work with a stack of patches in a Mercurial |
|
5 | 5 | repository. It manages two stacks of patches - all known patches, and |
|
6 | 6 | applied patches (subset of known patches). |
|
7 | 7 | |
|
8 | 8 | Known patches are represented as patch files in the .hg/patches |
|
9 | 9 | directory. Applied patches are both patch files and changesets. |
|
10 | 10 | |
|
11 | 11 | Common tasks (use "hg help command" for more details): |
|
12 | 12 | |
|
13 | 13 | prepare repository to work with patches qinit |
|
14 | 14 | create new patch qnew |
|
15 | 15 | import existing patch qimport |
|
16 | 16 | |
|
17 | 17 | print patch series qseries |
|
18 | 18 | print applied patches qapplied |
|
19 | 19 | print name of top applied patch qtop |
|
20 | 20 | |
|
21 | 21 | add known patch to applied stack qpush |
|
22 | 22 | remove patch from applied stack qpop |
|
23 | 23 | refresh contents of top applied patch qrefresh |
|
24 | 24 | |
|
25 | 25 | list of commands: |
|
26 | 26 | |
|
27 | 27 | qapplied print the patches already applied |
|
28 | 28 | qclone clone main and patch repository at same time |
|
29 | 29 | qcommit commit changes in the queue repository |
|
30 | 30 | qdelete remove patches from queue |
|
31 | 31 | qdiff diff of the current patch and subsequent modifications |
|
32 | 32 | qfinish move applied patches into repository history |
|
33 | 33 | qfold fold the named patches into the current patch |
|
34 | 34 | qgoto push or pop patches until named patch is at top of stack |
|
35 | 35 | qguard set or print guards for a patch |
|
36 | 36 | qheader Print the header of the topmost or specified patch |
|
37 | 37 | qimport import a patch |
|
38 | 38 | qinit init a new queue repository |
|
39 | 39 | qnew create a new patch |
|
40 | 40 | qnext print the name of the next patch |
|
41 | 41 | qpop pop the current patch off the stack |
|
42 | 42 | qprev print the name of the previous patch |
|
43 | 43 | qpush push the next patch onto the stack |
|
44 | 44 | qrefresh update the current patch |
|
45 | 45 | qrename rename a patch |
|
46 | 46 | qrestore restore the queue state saved by a rev |
|
47 | 47 | qsave save current queue state |
|
48 | 48 | qselect set or print guarded patches to push |
|
49 | 49 | qseries print the entire series file |
|
50 | 50 | qtop print the name of the current patch |
|
51 | 51 | qunapplied print the patches not yet applied |
|
52 | 52 | strip strip a revision and all its descendants from the repository |
|
53 | 53 | |
|
54 | 54 | use "hg -v help mq" to show aliases and global options |
|
55 | 55 | adding a |
|
56 | 56 | updating working directory |
|
57 | 57 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
58 | 58 | adding b/z |
|
59 | 59 | % qinit |
|
60 | 60 | % -R qinit |
|
61 | 61 | % qinit -c |
|
62 | 62 | A .hgignore |
|
63 | 63 | A series |
|
64 | 64 | % qnew should refuse bad patch names |
|
65 | 65 | abort: "series" cannot be used as the name of a patch |
|
66 | 66 | abort: "status" cannot be used as the name of a patch |
|
67 | 67 | abort: "guards" cannot be used as the name of a patch |
|
68 | 68 | abort: ".hgignore" cannot be used as the name of a patch |
|
69 | 69 | % qnew implies add |
|
70 | 70 | A .hgignore |
|
71 | 71 | A series |
|
72 | 72 | A test.patch |
|
73 | 73 | % qinit; qinit -c |
|
74 | 74 | .hgignore: |
|
75 | 75 | ^\.hg |
|
76 | 76 | ^\.mq |
|
77 | 77 | syntax: glob |
|
78 | 78 | status |
|
79 | 79 | guards |
|
80 | 80 | series: |
|
81 | 81 | abort: repository already exists! |
|
82 | 82 | % qinit; <stuff>; qinit -c |
|
83 | 83 | adding .hg/patches/A |
|
84 | 84 | adding .hg/patches/B |
|
85 | 85 | A .hgignore |
|
86 | 86 | A A |
|
87 | 87 | A B |
|
88 | 88 | A series |
|
89 | 89 | .hgignore: |
|
90 | 90 | status |
|
91 | 91 | bleh |
|
92 | 92 | series: |
|
93 | 93 | A |
|
94 | 94 | B |
|
95 | 95 | % qnew with uncommitted changes |
|
96 | 96 | abort: local changes found, refresh first |
|
97 | 97 | A somefile |
|
98 | 98 | % qnew with uncommitted changes and missing file (issue 803) |
|
99 | 99 | someotherfile: No such file or directory |
|
100 | 100 | someotherfile: No such file or directory |
|
101 | 101 | A somefile |
|
102 | 102 | issue803.patch |
|
103 | 103 | Patch queue now empty |
|
104 | 104 | % qnew -m |
|
105 | 105 | foo bar |
|
106 | 106 | % qrefresh |
|
107 | 107 | foo bar |
|
108 | 108 | |
|
109 | 109 | diff -r xa |
|
110 | 110 | --- a/a |
|
111 | 111 | +++ b/a |
|
112 | 112 | @@ -1,1 +1,2 @@ |
|
113 | 113 | a |
|
114 | 114 | +a |
|
115 | 115 | % empty qrefresh |
|
116 | 116 | revision: |
|
117 | 117 | patch: |
|
118 | 118 | foo bar |
|
119 | 119 | |
|
120 | 120 | working dir diff: |
|
121 | 121 | --- a/a |
|
122 | 122 | +++ b/a |
|
123 | 123 | @@ -1,1 +1,2 @@ |
|
124 | 124 | a |
|
125 | 125 | +a |
|
126 | 126 | % qpop |
|
127 | 127 | Patch queue now empty |
|
128 | 128 | % qpush |
|
129 | 129 | applying test.patch |
|
130 | 130 | Now at: test.patch |
|
131 | 131 | % pop/push outside repo |
|
132 | 132 | Patch queue now empty |
|
133 | 133 | applying test.patch |
|
134 | 134 | Now at: test.patch |
|
135 | 135 | % qrefresh in subdir |
|
136 | 136 | % pop/push -a in subdir |
|
137 | 137 | Patch queue now empty |
|
138 | 138 | applying test.patch |
|
139 | 139 | applying test2.patch |
|
140 | 140 | Now at: test2.patch |
|
141 | 141 | % qseries |
|
142 | 142 | test.patch |
|
143 | 143 | test2.patch |
|
144 | 144 | Now at: test.patch |
|
145 | 145 | 0 A test.patch: foo bar |
|
146 | 146 | 1 U test2.patch: |
|
147 | 147 | applying test2.patch |
|
148 | 148 | Now at: test2.patch |
|
149 | 149 | % qapplied |
|
150 | 150 | test.patch |
|
151 | 151 | test2.patch |
|
152 | 152 | % qtop |
|
153 | 153 | test2.patch |
|
154 | 154 | % qprev |
|
155 | 155 | test.patch |
|
156 | 156 | % qnext |
|
157 | 157 | All patches applied |
|
158 | 158 | % pop, qnext, qprev, qapplied |
|
159 | 159 | Now at: test.patch |
|
160 | 160 | test2.patch |
|
161 | 161 | Only one patch applied |
|
162 | 162 | test.patch |
|
163 | 163 | % commit should fail |
|
164 | 164 | abort: cannot commit over an applied mq patch |
|
165 | 165 | % push should fail |
|
166 | 166 | pushing to ../../k |
|
167 | 167 | abort: source has mq patches applied |
|
168 | 168 | % qunapplied |
|
169 | 169 | test2.patch |
|
170 | 170 | % qpush/qpop with index |
|
171 | 171 | applying test2.patch |
|
172 | 172 | Now at: test2.patch |
|
173 | 173 | Now at: test.patch |
|
174 | 174 | applying test1b.patch |
|
175 | 175 | Now at: test1b.patch |
|
176 | 176 | applying test2.patch |
|
177 | 177 | Now at: test2.patch |
|
178 | 178 | Now at: test1b.patch |
|
179 | 179 | Now at: test.patch |
|
180 | 180 | applying test1b.patch |
|
181 | 181 | applying test2.patch |
|
182 | 182 | Now at: test2.patch |
|
183 | 183 | % push should succeed |
|
184 | 184 | Patch queue now empty |
|
185 | 185 | pushing to ../../k |
|
186 | 186 | searching for changes |
|
187 | 187 | adding changesets |
|
188 | 188 | adding manifests |
|
189 | 189 | adding file changes |
|
190 | 190 | added 1 changesets with 1 changes to 1 files |
|
191 | 191 | % qpush/qpop error codes |
|
192 | 192 | applying test.patch |
|
193 | 193 | applying test1b.patch |
|
194 | 194 | applying test2.patch |
|
195 | 195 | Now at: test2.patch |
|
196 | 196 | % pops all patches and succeeds |
|
197 | 197 | Patch queue now empty |
|
198 | 198 | qpop -a succeeds |
|
199 | 199 | % does nothing and succeeds |
|
200 | 200 | no patches applied |
|
201 | 201 | qpop -a succeeds |
|
202 | 202 | % fails - nothing else to pop |
|
203 | 203 | no patches applied |
|
204 | 204 | qpop fails |
|
205 | 205 | % pushes a patch and succeeds |
|
206 | 206 | applying test.patch |
|
207 | 207 | Now at: test.patch |
|
208 | 208 | qpush succeeds |
|
209 | 209 | % pops a patch and succeeds |
|
210 | 210 | Patch queue now empty |
|
211 | 211 | qpop succeeds |
|
212 | 212 | % pushes up to test1b.patch and succeeds |
|
213 | 213 | applying test.patch |
|
214 | 214 | applying test1b.patch |
|
215 | 215 | Now at: test1b.patch |
|
216 | 216 | qpush test1b.patch succeeds |
|
217 | 217 | % does nothing and succeeds |
|
218 | 218 | qpush: test1b.patch is already at the top |
|
219 | 219 | qpush test1b.patch succeeds |
|
220 | 220 | % does nothing and succeeds |
|
221 | 221 | qpop: test1b.patch is already at the top |
|
222 | 222 | qpop test1b.patch succeeds |
|
223 | 223 | % fails - can't push to this patch |
|
224 | 224 | abort: cannot push to a previous patch: test.patch |
|
225 | 225 | qpush test.patch fails |
|
226 | 226 | % fails - can't pop to this patch |
|
227 | 227 | abort: patch test2.patch is not applied |
|
228 | 228 | qpop test2.patch fails |
|
229 | 229 | % pops up to test.patch and succeeds |
|
230 | 230 | Now at: test.patch |
|
231 | 231 | qpop test.patch succeeds |
|
232 | 232 | % pushes all patches and succeeds |
|
233 | 233 | applying test1b.patch |
|
234 | 234 | applying test2.patch |
|
235 | 235 | Now at: test2.patch |
|
236 | 236 | qpush -a succeeds |
|
237 | 237 | % does nothing and succeeds |
|
238 | 238 | all patches are currently applied |
|
239 | 239 | qpush -a succeeds |
|
240 | 240 | % fails - nothing else to push |
|
241 | 241 | patch series already fully applied |
|
242 | 242 | qpush fails |
|
243 | 243 | % does nothing and succeeds |
|
244 | 244 | all patches are currently applied |
|
245 | 245 | qpush test2.patch succeeds |
|
246 | 246 | % strip |
|
247 | 247 | adding x |
|
248 | 248 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
249 | 249 | saving bundle to |
|
250 | 250 | adding changesets |
|
251 | 251 | adding manifests |
|
252 | 252 | adding file changes |
|
253 | 253 | added 1 changesets with 1 changes to 1 files |
|
254 | 254 | (run 'hg update' to get a working copy) |
|
255 | 255 | % strip with local changes, should complain |
|
256 | 256 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
257 | 257 | abort: local changes found |
|
258 | 258 | % --force strip with local changes |
|
259 | 259 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
260 | 260 | saving bundle to |
|
261 | 261 | % cd b; hg qrefresh |
|
262 | 262 | adding a |
|
263 | 263 | foo |
|
264 | 264 | |
|
265 | 265 | diff -r cb9a9f314b8b a |
|
266 | 266 | --- a/a |
|
267 | 267 | +++ b/a |
|
268 | 268 | @@ -1,1 +1,2 @@ |
|
269 | 269 | a |
|
270 | 270 | +a |
|
271 | 271 | diff -r cb9a9f314b8b b/f |
|
272 | 272 | --- /dev/null |
|
273 | 273 | +++ b/b/f |
|
274 | 274 | @@ -0,0 +1,1 @@ |
|
275 | 275 | +f |
|
276 | 276 | % hg qrefresh . |
|
277 | 277 | foo |
|
278 | 278 | |
|
279 | 279 | diff -r cb9a9f314b8b b/f |
|
280 | 280 | --- /dev/null |
|
281 | 281 | +++ b/b/f |
|
282 | 282 | @@ -0,0 +1,1 @@ |
|
283 | 283 | +f |
|
284 | 284 | M a |
|
285 | 285 | % qpush failure |
|
286 | 286 | Patch queue now empty |
|
287 | 287 | applying foo |
|
288 | 288 | applying bar |
|
289 | 289 | file foo already exists |
|
290 | 290 | 1 out of 1 hunks FAILED -- saving rejects to file foo.rej |
|
291 | 291 | patch failed, unable to continue (try -v) |
|
292 | 292 | patch failed, rejects left in working dir |
|
293 | 293 | Errors during apply, please fix and refresh bar |
|
294 | 294 | ? foo |
|
295 | 295 | ? foo.rej |
|
296 | 296 | % mq tags |
|
297 | 297 | 0 qparent |
|
298 | 298 | 1 qbase foo |
|
299 | 299 | 2 qtip bar tip |
|
300 | 300 | % bad node in status |
|
301 | 301 | Now at: foo |
|
302 | 302 | changeset: 0:cb9a9f314b8b |
|
303 | 303 | mq status file refers to unknown node |
|
304 | 304 | tag: tip |
|
305 | 305 | user: test |
|
306 | 306 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
307 | 307 | summary: a |
|
308 | 308 | |
|
309 | 309 | mq status file refers to unknown node |
|
310 | 310 | default 0:cb9a9f314b8b |
|
311 | 311 | abort: working directory revision is not qtip |
|
312 | 312 | new file |
|
313 | 313 | |
|
314 | 314 | diff --git a/new b/new |
|
315 | 315 | new file mode 100755 |
|
316 | 316 | --- /dev/null |
|
317 | 317 | +++ b/new |
|
318 | 318 | @@ -0,0 +1,1 @@ |
|
319 | 319 | +foo |
|
320 | 320 | copy file |
|
321 | 321 | |
|
322 | 322 | diff --git a/new b/copy |
|
323 | 323 | copy from new |
|
324 | 324 | copy to copy |
|
325 | 325 | Now at: new |
|
326 | 326 | applying copy |
|
327 | 327 | Now at: copy |
|
328 | 328 | diff --git a/new b/copy |
|
329 | 329 | copy from new |
|
330 | 330 | copy to copy |
|
331 | 331 | diff --git a/new b/copy |
|
332 | 332 | copy from new |
|
333 | 333 | copy to copy |
|
334 | 334 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
335 | 335 | created new head |
|
336 | 336 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
337 | 337 | adding branch |
|
338 | 338 | adding changesets |
|
339 | 339 | adding manifests |
|
340 | 340 | adding file changes |
|
341 | 341 | added 1 changesets with 1 changes to 1 files |
|
342 | 342 | Patch queue now empty |
|
343 | 343 | (working directory not at tip) |
|
344 | 344 | applying bar |
|
345 | 345 | Now at: bar |
|
346 | 346 | diff --git a/bar b/bar |
|
347 | 347 | new file mode 100644 |
|
348 | 348 | --- /dev/null |
|
349 | 349 | +++ b/bar |
|
350 | 350 | @@ -0,0 +1,1 @@ |
|
351 | 351 | +bar |
|
352 | 352 | diff --git a/foo b/baz |
|
353 | 353 | rename from foo |
|
354 | 354 | rename to baz |
|
355 | 355 | 2 baz (foo) |
|
356 | 356 | diff --git a/bar b/bar |
|
357 | 357 | new file mode 100644 |
|
358 | 358 | --- /dev/null |
|
359 | 359 | +++ b/bar |
|
360 | 360 | @@ -0,0 +1,1 @@ |
|
361 | 361 | +bar |
|
362 | 362 | diff --git a/foo b/baz |
|
363 | 363 | rename from foo |
|
364 | 364 | rename to baz |
|
365 | 365 | 2 baz (foo) |
|
366 | 366 | diff --git a/bar b/bar |
|
367 | 367 | diff --git a/foo b/baz |
|
368 | 368 | |
|
369 | 369 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
370 | 370 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
371 | 371 | adding branch |
|
372 | 372 | adding changesets |
|
373 | 373 | adding manifests |
|
374 | 374 | adding file changes |
|
375 | 375 | added 1 changesets with 1 changes to 1 files |
|
376 | 376 | Patch queue now empty |
|
377 | 377 | (working directory not at tip) |
|
378 | 378 | applying bar |
|
379 | 379 | Now at: bar |
|
380 | 380 | diff --git a/foo b/bleh |
|
381 | 381 | rename from foo |
|
382 | 382 | rename to bleh |
|
383 | 383 | diff --git a/quux b/quux |
|
384 | 384 | new file mode 100644 |
|
385 | 385 | --- /dev/null |
|
386 | 386 | +++ b/quux |
|
387 | 387 | @@ -0,0 +1,1 @@ |
|
388 | 388 | +bar |
|
389 | 389 | 3 bleh (foo) |
|
390 | 390 | diff --git a/foo b/barney |
|
391 | 391 | rename from foo |
|
392 | 392 | rename to barney |
|
393 | 393 | diff --git a/fred b/fred |
|
394 | 394 | new file mode 100644 |
|
395 | 395 | --- /dev/null |
|
396 | 396 | +++ b/fred |
|
397 | 397 | @@ -0,0 +1,1 @@ |
|
398 | 398 | +bar |
|
399 | 399 | 3 barney (foo) |
|
400 | 400 | % refresh omitting an added file |
|
401 | 401 | C newfile |
|
402 | 402 | A newfile |
|
403 | 403 | Now at: bar |
|
404 | 404 | % create a git patch |
|
405 | 405 | diff --git a/alexander b/alexander |
|
406 | 406 | % create a git binary patch |
|
407 | 407 | 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
408 | 408 | diff --git a/bucephalus b/bucephalus |
|
409 | 409 | % check binary patches can be popped and pushed |
|
410 | 410 | Now at: addalexander |
|
411 | 411 | applying addbucephalus |
|
412 | 412 | Now at: addbucephalus |
|
413 | 413 | 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus |
|
414 | 414 | % strip again |
|
415 | 415 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
416 | 416 | created new head |
|
417 | 417 | merging foo |
|
418 | 418 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
419 | 419 | (branch merge, don't forget to commit) |
|
420 | 420 | changeset: 3:99615015637b |
|
421 | 421 | tag: tip |
|
422 | 422 | parent: 2:20cbbe65cff7 |
|
423 | 423 | parent: 1:d2871fc282d4 |
|
424 | 424 | user: test |
|
425 | 425 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
426 | 426 | summary: merge |
|
427 | 427 | |
|
428 | 428 | changeset: 2:20cbbe65cff7 |
|
429 | 429 | parent: 0:53245c60e682 |
|
430 | 430 | user: test |
|
431 | 431 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
432 | 432 | summary: change foo 2 |
|
433 | 433 | |
|
434 | 434 | changeset: 1:d2871fc282d4 |
|
435 | 435 | user: test |
|
436 | 436 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
437 | 437 | summary: change foo 1 |
|
438 | 438 | |
|
439 | 439 | changeset: 0:53245c60e682 |
|
440 | 440 | user: test |
|
441 | 441 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
442 | 442 | summary: add foo |
|
443 | 443 | |
|
444 | 444 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
445 | 445 | saving bundle to |
|
446 | 446 | saving bundle to |
|
447 | 447 | adding branch |
|
448 | 448 | adding changesets |
|
449 | 449 | adding manifests |
|
450 | 450 | adding file changes |
|
451 | 451 | added 1 changesets with 1 changes to 1 files |
|
452 | 452 | changeset: 1:20cbbe65cff7 |
|
453 | 453 | tag: tip |
|
454 | 454 | user: test |
|
455 | 455 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
456 | 456 | summary: change foo 2 |
|
457 | 457 | |
|
458 | 458 | changeset: 0:53245c60e682 |
|
459 | 459 | user: test |
|
460 | 460 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
461 | 461 | summary: add foo |
|
462 | 462 | |
|
463 | 463 | % qclone |
|
464 | 464 | abort: versioned patch repository not found (see qinit -c) |
|
465 | 465 | adding .hg/patches/patch1 |
|
466 | 466 | main repo: |
|
467 | 467 | rev 1: change foo |
|
468 | 468 | rev 0: add foo |
|
469 | 469 | patch repo: |
|
470 | 470 | rev 0: checkpoint |
|
471 | 471 | updating working directory |
|
472 | 472 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
473 | 473 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
474 | 474 | main repo: |
|
475 | 475 | rev 0: add foo |
|
476 | 476 | patch repo: |
|
477 | 477 | rev 0: checkpoint |
|
478 | 478 | Patch queue now empty |
|
479 | 479 | main repo: |
|
480 | 480 | rev 0: add foo |
|
481 | 481 | patch repo: |
|
482 | 482 | rev 0: checkpoint |
|
483 | 483 | updating working directory |
|
484 | 484 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
485 | 485 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
486 | 486 | main repo: |
|
487 | 487 | rev 0: add foo |
|
488 | 488 | patch repo: |
|
489 | 489 | rev 0: checkpoint |
|
490 | 490 | % test applying on an empty file (issue 1033) |
|
491 | 491 | adding a |
|
492 | 492 | Patch queue now empty |
|
493 | 493 | applying changea |
|
494 | 494 | Now at: changea |
|
495 | 495 | % test qpush with --force, issue1087 |
|
496 | 496 | adding bye.txt |
|
497 | 497 | adding hello.txt |
|
498 | 498 | Patch queue now empty |
|
499 | 499 | % qpush should fail, local changes |
|
500 | 500 | abort: local changes found, refresh first |
|
501 | 501 | % apply force, should not discard changes with empty patch |
|
502 | 502 | applying empty |
|
503 |
|
|
|
503 | patch: **** Only garbage was found in the patch input. | |
|
504 | 504 | patch failed, unable to continue (try -v) |
|
505 | 505 | patch empty is empty |
|
506 | 506 | Now at: empty |
|
507 | 507 | diff -r bf5fc3f07a0a hello.txt |
|
508 | 508 | --- a/hello.txt |
|
509 | 509 | +++ b/hello.txt |
|
510 | 510 | @@ -1,1 +1,2 @@ |
|
511 | 511 | hello |
|
512 | 512 | +world |
|
513 | 513 | diff -r 9ecee4f634e3 hello.txt |
|
514 | 514 | --- a/hello.txt |
|
515 | 515 | +++ b/hello.txt |
|
516 | 516 | @@ -1,1 +1,2 @@ |
|
517 | 517 | hello |
|
518 | 518 | +world |
|
519 | 519 | changeset: 1:bf5fc3f07a0a |
|
520 | 520 | tag: qtip |
|
521 | 521 | tag: tip |
|
522 | 522 | tag: empty |
|
523 | 523 | tag: qbase |
|
524 | 524 | user: test |
|
525 | 525 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
526 | 526 | summary: imported patch empty |
|
527 | 527 | |
|
528 | 528 | |
|
529 | 529 | Patch queue now empty |
|
530 | 530 | % qpush should fail, local changes |
|
531 | 531 | abort: local changes found, refresh first |
|
532 | 532 | % apply force, should discard changes in hello, but not bye |
|
533 | 533 | applying empty |
|
534 | 534 | Now at: empty |
|
535 | 535 | M bye.txt |
|
536 | 536 | diff -r ba252371dbc1 bye.txt |
|
537 | 537 | --- a/bye.txt |
|
538 | 538 | +++ b/bye.txt |
|
539 | 539 | @@ -1,1 +1,2 @@ |
|
540 | 540 | bye |
|
541 | 541 | +universe |
|
542 | 542 | diff -r 9ecee4f634e3 bye.txt |
|
543 | 543 | --- a/bye.txt |
|
544 | 544 | +++ b/bye.txt |
|
545 | 545 | @@ -1,1 +1,2 @@ |
|
546 | 546 | bye |
|
547 | 547 | +universe |
|
548 | 548 | diff -r 9ecee4f634e3 hello.txt |
|
549 | 549 | --- a/hello.txt |
|
550 | 550 | +++ b/hello.txt |
|
551 | 551 | @@ -1,1 +1,3 @@ |
|
552 | 552 | hello |
|
553 | 553 | +world |
|
554 | 554 | +universe |
General Comments 0
You need to be logged in to leave comments.
Login now