Show More
@@ -1,661 +1,660 b'' | |||
|
1 | 1 | # record.py |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | '''commands to interactively select changes for commit/qrefresh''' |
|
9 | 9 | |
|
10 | 10 | from mercurial.i18n import _ |
|
11 | 11 | from mercurial import cmdutil, commands, extensions, hg, patch |
|
12 | 12 | from mercurial import util |
|
13 | 13 | import copy, cStringIO, errno, os, re, shutil, tempfile |
|
14 | 14 | |
|
15 | 15 | cmdtable = {} |
|
16 | 16 | command = cmdutil.command(cmdtable) |
|
17 | 17 | testedwith = 'internal' |
|
18 | 18 | |
|
19 | 19 | lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)') |
|
20 | 20 | |
|
21 | 21 | def scanpatch(fp): |
|
22 | 22 | """like patch.iterhunks, but yield different events |
|
23 | 23 | |
|
24 | 24 | - ('file', [header_lines + fromfile + tofile]) |
|
25 | 25 | - ('context', [context_lines]) |
|
26 | 26 | - ('hunk', [hunk_lines]) |
|
27 | 27 | - ('range', (-start,len, +start,len, proc)) |
|
28 | 28 | """ |
|
29 | 29 | lr = patch.linereader(fp) |
|
30 | 30 | |
|
31 | 31 | def scanwhile(first, p): |
|
32 | 32 | """scan lr while predicate holds""" |
|
33 | 33 | lines = [first] |
|
34 | 34 | while True: |
|
35 | 35 | line = lr.readline() |
|
36 | 36 | if not line: |
|
37 | 37 | break |
|
38 | 38 | if p(line): |
|
39 | 39 | lines.append(line) |
|
40 | 40 | else: |
|
41 | 41 | lr.push(line) |
|
42 | 42 | break |
|
43 | 43 | return lines |
|
44 | 44 | |
|
45 | 45 | while True: |
|
46 | 46 | line = lr.readline() |
|
47 | 47 | if not line: |
|
48 | 48 | break |
|
49 | 49 | if line.startswith('diff --git a/') or line.startswith('diff -r '): |
|
50 | 50 | def notheader(line): |
|
51 | 51 | s = line.split(None, 1) |
|
52 | 52 | return not s or s[0] not in ('---', 'diff') |
|
53 | 53 | header = scanwhile(line, notheader) |
|
54 | 54 | fromfile = lr.readline() |
|
55 | 55 | if fromfile.startswith('---'): |
|
56 | 56 | tofile = lr.readline() |
|
57 | 57 | header += [fromfile, tofile] |
|
58 | 58 | else: |
|
59 | 59 | lr.push(fromfile) |
|
60 | 60 | yield 'file', header |
|
61 | 61 | elif line[0] == ' ': |
|
62 | 62 | yield 'context', scanwhile(line, lambda l: l[0] in ' \\') |
|
63 | 63 | elif line[0] in '-+': |
|
64 | 64 | yield 'hunk', scanwhile(line, lambda l: l[0] in '-+\\') |
|
65 | 65 | else: |
|
66 | 66 | m = lines_re.match(line) |
|
67 | 67 | if m: |
|
68 | 68 | yield 'range', m.groups() |
|
69 | 69 | else: |
|
70 | 70 | yield 'other', line |
|
71 | 71 | |
|
72 | 72 | class header(object): |
|
73 | 73 | """patch header |
|
74 | 74 | |
|
75 | 75 | XXX shouldn't we move this to mercurial/patch.py ? |
|
76 | 76 | """ |
|
77 | 77 | diffgit_re = re.compile('diff --git a/(.*) b/(.*)$') |
|
78 | 78 | diff_re = re.compile('diff -r .* (.*)$') |
|
79 | 79 | allhunks_re = re.compile('(?:index|new file|deleted file) ') |
|
80 | 80 | pretty_re = re.compile('(?:new file|deleted file) ') |
|
81 | 81 | special_re = re.compile('(?:index|new|deleted|copy|rename) ') |
|
82 | 82 | |
|
83 | 83 | def __init__(self, header): |
|
84 | 84 | self.header = header |
|
85 | 85 | self.hunks = [] |
|
86 | 86 | |
|
87 | 87 | def binary(self): |
|
88 | 88 | return util.any(h.startswith('index ') for h in self.header) |
|
89 | 89 | |
|
90 | 90 | def pretty(self, fp): |
|
91 | 91 | for h in self.header: |
|
92 | 92 | if h.startswith('index '): |
|
93 | 93 | fp.write(_('this modifies a binary file (all or nothing)\n')) |
|
94 | 94 | break |
|
95 | 95 | if self.pretty_re.match(h): |
|
96 | 96 | fp.write(h) |
|
97 | 97 | if self.binary(): |
|
98 | 98 | fp.write(_('this is a binary file\n')) |
|
99 | 99 | break |
|
100 | 100 | if h.startswith('---'): |
|
101 | 101 | fp.write(_('%d hunks, %d lines changed\n') % |
|
102 | 102 | (len(self.hunks), |
|
103 | 103 | sum([max(h.added, h.removed) for h in self.hunks]))) |
|
104 | 104 | break |
|
105 | 105 | fp.write(h) |
|
106 | 106 | |
|
107 | 107 | def write(self, fp): |
|
108 | 108 | fp.write(''.join(self.header)) |
|
109 | 109 | |
|
110 | 110 | def allhunks(self): |
|
111 | 111 | return util.any(self.allhunks_re.match(h) for h in self.header) |
|
112 | 112 | |
|
113 | 113 | def files(self): |
|
114 | 114 | match = self.diffgit_re.match(self.header[0]) |
|
115 | 115 | if match: |
|
116 | 116 | fromfile, tofile = match.groups() |
|
117 | 117 | if fromfile == tofile: |
|
118 | 118 | return [fromfile] |
|
119 | 119 | return [fromfile, tofile] |
|
120 | 120 | else: |
|
121 | 121 | return self.diff_re.match(self.header[0]).groups() |
|
122 | 122 | |
|
123 | 123 | def filename(self): |
|
124 | 124 | return self.files()[-1] |
|
125 | 125 | |
|
126 | 126 | def __repr__(self): |
|
127 | 127 | return '<header %s>' % (' '.join(map(repr, self.files()))) |
|
128 | 128 | |
|
129 | 129 | def special(self): |
|
130 | 130 | return util.any(self.special_re.match(h) for h in self.header) |
|
131 | 131 | |
|
132 | 132 | def countchanges(hunk): |
|
133 | 133 | """hunk -> (n+,n-)""" |
|
134 | 134 | add = len([h for h in hunk if h[0] == '+']) |
|
135 | 135 | rem = len([h for h in hunk if h[0] == '-']) |
|
136 | 136 | return add, rem |
|
137 | 137 | |
|
138 | 138 | class hunk(object): |
|
139 | 139 | """patch hunk |
|
140 | 140 | |
|
141 | 141 | XXX shouldn't we merge this with patch.hunk ? |
|
142 | 142 | """ |
|
143 | 143 | maxcontext = 3 |
|
144 | 144 | |
|
145 | 145 | def __init__(self, header, fromline, toline, proc, before, hunk, after): |
|
146 | 146 | def trimcontext(number, lines): |
|
147 | 147 | delta = len(lines) - self.maxcontext |
|
148 | 148 | if False and delta > 0: |
|
149 | 149 | return number + delta, lines[:self.maxcontext] |
|
150 | 150 | return number, lines |
|
151 | 151 | |
|
152 | 152 | self.header = header |
|
153 | 153 | self.fromline, self.before = trimcontext(fromline, before) |
|
154 | 154 | self.toline, self.after = trimcontext(toline, after) |
|
155 | 155 | self.proc = proc |
|
156 | 156 | self.hunk = hunk |
|
157 | 157 | self.added, self.removed = countchanges(self.hunk) |
|
158 | 158 | |
|
159 | 159 | def write(self, fp): |
|
160 | 160 | delta = len(self.before) + len(self.after) |
|
161 | 161 | if self.after and self.after[-1] == '\\ No newline at end of file\n': |
|
162 | 162 | delta -= 1 |
|
163 | 163 | fromlen = delta + self.removed |
|
164 | 164 | tolen = delta + self.added |
|
165 | 165 | fp.write('@@ -%d,%d +%d,%d @@%s\n' % |
|
166 | 166 | (self.fromline, fromlen, self.toline, tolen, |
|
167 | 167 | self.proc and (' ' + self.proc))) |
|
168 | 168 | fp.write(''.join(self.before + self.hunk + self.after)) |
|
169 | 169 | |
|
170 | 170 | pretty = write |
|
171 | 171 | |
|
172 | 172 | def filename(self): |
|
173 | 173 | return self.header.filename() |
|
174 | 174 | |
|
175 | 175 | def __repr__(self): |
|
176 | 176 | return '<hunk %r@%d>' % (self.filename(), self.fromline) |
|
177 | 177 | |
|
178 | 178 | def parsepatch(fp): |
|
179 | 179 | """patch -> [] of headers -> [] of hunks """ |
|
180 | 180 | class parser(object): |
|
181 | 181 | """patch parsing state machine""" |
|
182 | 182 | def __init__(self): |
|
183 | 183 | self.fromline = 0 |
|
184 | 184 | self.toline = 0 |
|
185 | 185 | self.proc = '' |
|
186 | 186 | self.header = None |
|
187 | 187 | self.context = [] |
|
188 | 188 | self.before = [] |
|
189 | 189 | self.hunk = [] |
|
190 | 190 | self.headers = [] |
|
191 | 191 | |
|
192 | 192 | def addrange(self, limits): |
|
193 | 193 | fromstart, fromend, tostart, toend, proc = limits |
|
194 | 194 | self.fromline = int(fromstart) |
|
195 | 195 | self.toline = int(tostart) |
|
196 | 196 | self.proc = proc |
|
197 | 197 | |
|
198 | 198 | def addcontext(self, context): |
|
199 | 199 | if self.hunk: |
|
200 | 200 | h = hunk(self.header, self.fromline, self.toline, self.proc, |
|
201 | 201 | self.before, self.hunk, context) |
|
202 | 202 | self.header.hunks.append(h) |
|
203 | 203 | self.fromline += len(self.before) + h.removed |
|
204 | 204 | self.toline += len(self.before) + h.added |
|
205 | 205 | self.before = [] |
|
206 | 206 | self.hunk = [] |
|
207 | 207 | self.proc = '' |
|
208 | 208 | self.context = context |
|
209 | 209 | |
|
210 | 210 | def addhunk(self, hunk): |
|
211 | 211 | if self.context: |
|
212 | 212 | self.before = self.context |
|
213 | 213 | self.context = [] |
|
214 | 214 | self.hunk = hunk |
|
215 | 215 | |
|
216 | 216 | def newfile(self, hdr): |
|
217 | 217 | self.addcontext([]) |
|
218 | 218 | h = header(hdr) |
|
219 | 219 | self.headers.append(h) |
|
220 | 220 | self.header = h |
|
221 | 221 | |
|
222 | 222 | def addother(self, line): |
|
223 | 223 | pass # 'other' lines are ignored |
|
224 | 224 | |
|
225 | 225 | def finished(self): |
|
226 | 226 | self.addcontext([]) |
|
227 | 227 | return self.headers |
|
228 | 228 | |
|
229 | 229 | transitions = { |
|
230 | 230 | 'file': {'context': addcontext, |
|
231 | 231 | 'file': newfile, |
|
232 | 232 | 'hunk': addhunk, |
|
233 | 233 | 'range': addrange}, |
|
234 | 234 | 'context': {'file': newfile, |
|
235 | 235 | 'hunk': addhunk, |
|
236 | 236 | 'range': addrange, |
|
237 | 237 | 'other': addother}, |
|
238 | 238 | 'hunk': {'context': addcontext, |
|
239 | 239 | 'file': newfile, |
|
240 | 240 | 'range': addrange}, |
|
241 | 241 | 'range': {'context': addcontext, |
|
242 | 242 | 'hunk': addhunk}, |
|
243 | 243 | 'other': {'other': addother}, |
|
244 | 244 | } |
|
245 | 245 | |
|
246 | 246 | p = parser() |
|
247 | 247 | |
|
248 | 248 | state = 'context' |
|
249 | 249 | for newstate, data in scanpatch(fp): |
|
250 | 250 | try: |
|
251 | 251 | p.transitions[state][newstate](p, data) |
|
252 | 252 | except KeyError: |
|
253 | 253 | raise patch.PatchError('unhandled transition: %s -> %s' % |
|
254 | 254 | (state, newstate)) |
|
255 | 255 | state = newstate |
|
256 | 256 | return p.finished() |
|
257 | 257 | |
|
258 | 258 | def filterpatch(ui, headers): |
|
259 | 259 | """Interactively filter patch chunks into applied-only chunks""" |
|
260 | 260 | |
|
261 | 261 | def prompt(skipfile, skipall, query, chunk): |
|
262 | 262 | """prompt query, and process base inputs |
|
263 | 263 | |
|
264 | 264 | - y/n for the rest of file |
|
265 | 265 | - y/n for the rest |
|
266 | 266 | - ? (help) |
|
267 | 267 | - q (quit) |
|
268 | 268 | |
|
269 | 269 | Return True/False and possibly updated skipfile and skipall. |
|
270 | 270 | """ |
|
271 | 271 | newpatches = None |
|
272 | 272 | if skipall is not None: |
|
273 | 273 | return skipall, skipfile, skipall, newpatches |
|
274 | 274 | if skipfile is not None: |
|
275 | 275 | return skipfile, skipfile, skipall, newpatches |
|
276 | 276 | while True: |
|
277 | 277 | resps = _('[Ynesfdaq?]' |
|
278 | 278 | '$$ &Yes, record this change' |
|
279 | 279 | '$$ &No, skip this change' |
|
280 | 280 | '$$ &Edit this change manually' |
|
281 | 281 | '$$ &Skip remaining changes to this file' |
|
282 | 282 | '$$ Record remaining changes to this &file' |
|
283 | 283 | '$$ &Done, skip remaining changes and files' |
|
284 | 284 | '$$ Record &all changes to all remaining files' |
|
285 | 285 | '$$ &Quit, recording no changes' |
|
286 | 286 | '$$ &? (display help)') |
|
287 | 287 | r = ui.promptchoice("%s %s" % (query, resps)) |
|
288 | 288 | ui.write("\n") |
|
289 | 289 | if r == 8: # ? |
|
290 | 290 | for c, t in ui.extractchoices(resps)[1]: |
|
291 | 291 | ui.write('%s - %s\n' % (c, t.lower())) |
|
292 | 292 | continue |
|
293 | 293 | elif r == 0: # yes |
|
294 | 294 | ret = True |
|
295 | 295 | elif r == 1: # no |
|
296 | 296 | ret = False |
|
297 | 297 | elif r == 2: # Edit patch |
|
298 | 298 | if chunk is None: |
|
299 | 299 | ui.write(_('cannot edit patch for whole file')) |
|
300 | 300 | ui.write("\n") |
|
301 | 301 | continue |
|
302 | 302 | if chunk.header.binary(): |
|
303 | 303 | ui.write(_('cannot edit patch for binary file')) |
|
304 | 304 | ui.write("\n") |
|
305 | 305 | continue |
|
306 | 306 | # Patch comment based on the Git one (based on comment at end of |
|
307 | 307 | # http://mercurial.selenic.com/wiki/RecordExtension) |
|
308 | 308 | phelp = '---' + _(""" |
|
309 | 309 | To remove '-' lines, make them ' ' lines (context). |
|
310 | 310 | To remove '+' lines, delete them. |
|
311 | 311 | Lines starting with # will be removed from the patch. |
|
312 | 312 | |
|
313 | 313 | If the patch applies cleanly, the edited hunk will immediately be |
|
314 | 314 | added to the record list. If it does not apply cleanly, a rejects |
|
315 | 315 | file will be generated: you can use that when you try again. If |
|
316 | 316 | all lines of the hunk are removed, then the edit is aborted and |
|
317 | 317 | the hunk is left unchanged. |
|
318 | 318 | """) |
|
319 | 319 | (patchfd, patchfn) = tempfile.mkstemp(prefix="hg-editor-", |
|
320 | 320 | suffix=".diff", text=True) |
|
321 | 321 | ncpatchfp = None |
|
322 | 322 | try: |
|
323 | 323 | # Write the initial patch |
|
324 | 324 | f = os.fdopen(patchfd, "w") |
|
325 | 325 | chunk.header.write(f) |
|
326 | 326 | chunk.write(f) |
|
327 | 327 | f.write('\n'.join(['# ' + i for i in phelp.splitlines()])) |
|
328 | 328 | f.close() |
|
329 | 329 | # Start the editor and wait for it to complete |
|
330 | 330 | editor = ui.geteditor() |
|
331 | 331 | ui.system("%s \"%s\"" % (editor, patchfn), |
|
332 | 332 | environ={'HGUSER': ui.username()}, |
|
333 | 333 | onerr=util.Abort, errprefix=_("edit failed")) |
|
334 | 334 | # Remove comment lines |
|
335 | 335 | patchfp = open(patchfn) |
|
336 | 336 | ncpatchfp = cStringIO.StringIO() |
|
337 | 337 | for line in patchfp: |
|
338 | 338 | if not line.startswith('#'): |
|
339 | 339 | ncpatchfp.write(line) |
|
340 | 340 | patchfp.close() |
|
341 | 341 | ncpatchfp.seek(0) |
|
342 | 342 | newpatches = parsepatch(ncpatchfp) |
|
343 | 343 | finally: |
|
344 | 344 | os.unlink(patchfn) |
|
345 | 345 | del ncpatchfp |
|
346 | 346 | # Signal that the chunk shouldn't be applied as-is, but |
|
347 | 347 | # provide the new patch to be used instead. |
|
348 | 348 | ret = False |
|
349 | 349 | elif r == 3: # Skip |
|
350 | 350 | ret = skipfile = False |
|
351 | 351 | elif r == 4: # file (Record remaining) |
|
352 | 352 | ret = skipfile = True |
|
353 | 353 | elif r == 5: # done, skip remaining |
|
354 | 354 | ret = skipall = False |
|
355 | 355 | elif r == 6: # all |
|
356 | 356 | ret = skipall = True |
|
357 | 357 | elif r == 7: # quit |
|
358 | 358 | raise util.Abort(_('user quit')) |
|
359 | 359 | return ret, skipfile, skipall, newpatches |
|
360 | 360 | |
|
361 | 361 | seen = set() |
|
362 | 362 | applied = {} # 'filename' -> [] of chunks |
|
363 | 363 | skipfile, skipall = None, None |
|
364 | 364 | pos, total = 1, sum(len(h.hunks) for h in headers) |
|
365 | 365 | for h in headers: |
|
366 | 366 | pos += len(h.hunks) |
|
367 | 367 | skipfile = None |
|
368 | 368 | fixoffset = 0 |
|
369 | 369 | hdr = ''.join(h.header) |
|
370 | 370 | if hdr in seen: |
|
371 | 371 | continue |
|
372 | 372 | seen.add(hdr) |
|
373 | 373 | if skipall is None: |
|
374 | 374 | h.pretty(ui) |
|
375 | 375 | msg = (_('examine changes to %s?') % |
|
376 | 376 | _(' and ').join("'%s'" % f for f in h.files())) |
|
377 | 377 | r, skipfile, skipall, np = prompt(skipfile, skipall, msg, None) |
|
378 | 378 | if not r: |
|
379 | 379 | continue |
|
380 | 380 | applied[h.filename()] = [h] |
|
381 | 381 | if h.allhunks(): |
|
382 | 382 | applied[h.filename()] += h.hunks |
|
383 | 383 | continue |
|
384 | 384 | for i, chunk in enumerate(h.hunks): |
|
385 | 385 | if skipfile is None and skipall is None: |
|
386 | 386 | chunk.pretty(ui) |
|
387 | 387 | if total == 1: |
|
388 | 388 | msg = _("record this change to '%s'?") % chunk.filename() |
|
389 | 389 | else: |
|
390 | 390 | idx = pos - len(h.hunks) + i |
|
391 | 391 | msg = _("record change %d/%d to '%s'?") % (idx, total, |
|
392 | 392 | chunk.filename()) |
|
393 | 393 | r, skipfile, skipall, newpatches = prompt(skipfile, |
|
394 | 394 | skipall, msg, chunk) |
|
395 | 395 | if r: |
|
396 | 396 | if fixoffset: |
|
397 | 397 | chunk = copy.copy(chunk) |
|
398 | 398 | chunk.toline += fixoffset |
|
399 | 399 | applied[chunk.filename()].append(chunk) |
|
400 | 400 | elif newpatches is not None: |
|
401 | 401 | for newpatch in newpatches: |
|
402 | 402 | for newhunk in newpatch.hunks: |
|
403 | 403 | if fixoffset: |
|
404 | 404 | newhunk.toline += fixoffset |
|
405 | 405 | applied[newhunk.filename()].append(newhunk) |
|
406 | 406 | else: |
|
407 | 407 | fixoffset += chunk.removed - chunk.added |
|
408 | 408 | return sum([h for h in applied.itervalues() |
|
409 | 409 | if h[0].special() or len(h) > 1], []) |
|
410 | 410 | |
|
411 | 411 | @command("record", |
|
412 | 412 | # same options as commit + white space diff options |
|
413 | 413 | commands.table['^commit|ci'][1][:] + commands.diffwsopts, |
|
414 | 414 | _('hg record [OPTION]... [FILE]...')) |
|
415 | 415 | def record(ui, repo, *pats, **opts): |
|
416 | 416 | '''interactively select changes to commit |
|
417 | 417 | |
|
418 | 418 | If a list of files is omitted, all changes reported by :hg:`status` |
|
419 | 419 | will be candidates for recording. |
|
420 | 420 | |
|
421 | 421 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
422 | 422 | |
|
423 | 423 | You will be prompted for whether to record changes to each |
|
424 | 424 | modified file, and for files with multiple changes, for each |
|
425 | 425 | change to use. For each query, the following responses are |
|
426 | 426 | possible:: |
|
427 | 427 | |
|
428 | 428 | y - record this change |
|
429 | 429 | n - skip this change |
|
430 | 430 | e - edit this change manually |
|
431 | 431 | |
|
432 | 432 | s - skip remaining changes to this file |
|
433 | 433 | f - record remaining changes to this file |
|
434 | 434 | |
|
435 | 435 | d - done, skip remaining changes and files |
|
436 | 436 | a - record all changes to all remaining files |
|
437 | 437 | q - quit, recording no changes |
|
438 | 438 | |
|
439 | 439 | ? - display help |
|
440 | 440 | |
|
441 | 441 | This command is not available when committing a merge.''' |
|
442 | 442 | |
|
443 | 443 | dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts) |
|
444 | 444 | |
|
445 | 445 | def qrefresh(origfn, ui, repo, *pats, **opts): |
|
446 | 446 | if not opts['interactive']: |
|
447 | 447 | return origfn(ui, repo, *pats, **opts) |
|
448 | 448 | |
|
449 | 449 | mq = extensions.find('mq') |
|
450 | 450 | |
|
451 | 451 | def committomq(ui, repo, *pats, **opts): |
|
452 | 452 | # At this point the working copy contains only changes that |
|
453 | 453 | # were accepted. All other changes were reverted. |
|
454 | 454 | # We can't pass *pats here since qrefresh will undo all other |
|
455 | 455 | # changed files in the patch that aren't in pats. |
|
456 | 456 | mq.refresh(ui, repo, **opts) |
|
457 | 457 | |
|
458 | 458 | # backup all changed files |
|
459 | 459 | dorecord(ui, repo, committomq, 'qrefresh', True, *pats, **opts) |
|
460 | 460 | |
|
461 | 461 | # This command registration is replaced during uisetup(). |
|
462 | 462 | @command('qrecord', |
|
463 | 463 | [], |
|
464 | 464 | _('hg qrecord [OPTION]... PATCH [FILE]...'), |
|
465 | 465 | inferrepo=True) |
|
466 | 466 | def qrecord(ui, repo, patch, *pats, **opts): |
|
467 | 467 | '''interactively record a new patch |
|
468 | 468 | |
|
469 | 469 | See :hg:`help qnew` & :hg:`help record` for more information and |
|
470 | 470 | usage. |
|
471 | 471 | ''' |
|
472 | 472 | |
|
473 | 473 | try: |
|
474 | 474 | mq = extensions.find('mq') |
|
475 | 475 | except KeyError: |
|
476 | 476 | raise util.Abort(_("'mq' extension not loaded")) |
|
477 | 477 | |
|
478 | 478 | repo.mq.checkpatchname(patch) |
|
479 | 479 | |
|
480 | 480 | def committomq(ui, repo, *pats, **opts): |
|
481 | 481 | opts['checkname'] = False |
|
482 | 482 | mq.new(ui, repo, patch, *pats, **opts) |
|
483 | 483 | |
|
484 | 484 | dorecord(ui, repo, committomq, 'qnew', False, *pats, **opts) |
|
485 | 485 | |
|
486 | 486 | def qnew(origfn, ui, repo, patch, *args, **opts): |
|
487 | 487 | if opts['interactive']: |
|
488 | 488 | return qrecord(ui, repo, patch, *args, **opts) |
|
489 | 489 | return origfn(ui, repo, patch, *args, **opts) |
|
490 | 490 | |
|
491 | 491 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts): |
|
492 | 492 | if not ui.interactive(): |
|
493 | 493 | raise util.Abort(_('running non-interactively, use %s instead') % |
|
494 | 494 | cmdsuggest) |
|
495 | 495 | |
|
496 | 496 | # make sure username is set before going interactive |
|
497 | 497 | if not opts.get('user'): |
|
498 | 498 | ui.username() # raise exception, username not provided |
|
499 | 499 | |
|
500 | 500 | def recordfunc(ui, repo, message, match, opts): |
|
501 | 501 | """This is generic record driver. |
|
502 | 502 | |
|
503 | 503 | Its job is to interactively filter local changes, and |
|
504 | 504 | accordingly prepare working directory into a state in which the |
|
505 | 505 | job can be delegated to a non-interactive commit command such as |
|
506 | 506 | 'commit' or 'qrefresh'. |
|
507 | 507 | |
|
508 | 508 | After the actual job is done by non-interactive command, the |
|
509 | 509 | working directory is restored to its original state. |
|
510 | 510 | |
|
511 | 511 | In the end we'll record interesting changes, and everything else |
|
512 | 512 | will be left in place, so the user can continue working. |
|
513 | 513 | """ |
|
514 | 514 | |
|
515 | 515 | cmdutil.checkunfinished(repo, commit=True) |
|
516 | 516 | merge = len(repo[None].parents()) > 1 |
|
517 | 517 | if merge: |
|
518 | 518 | raise util.Abort(_('cannot partially commit a merge ' |
|
519 | 519 | '(use "hg commit" instead)')) |
|
520 | 520 | |
|
521 | 521 | status = repo.status(match=match) |
|
522 | diffopts = opts.copy() | |
|
523 |
diffopts |
|
|
524 |
diffopts |
|
|
525 | diffopts = patch.diffopts(ui, opts=diffopts) | |
|
522 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) | |
|
523 | diffopts.nodates = True | |
|
524 | diffopts.git = True | |
|
526 | 525 | chunks = patch.diff(repo, changes=status, opts=diffopts) |
|
527 | 526 | fp = cStringIO.StringIO() |
|
528 | 527 | fp.write(''.join(chunks)) |
|
529 | 528 | fp.seek(0) |
|
530 | 529 | |
|
531 | 530 | # 1. filter patch, so we have intending-to apply subset of it |
|
532 | 531 | try: |
|
533 | 532 | chunks = filterpatch(ui, parsepatch(fp)) |
|
534 | 533 | except patch.PatchError, err: |
|
535 | 534 | raise util.Abort(_('error parsing patch: %s') % err) |
|
536 | 535 | |
|
537 | 536 | del fp |
|
538 | 537 | |
|
539 | 538 | contenders = set() |
|
540 | 539 | for h in chunks: |
|
541 | 540 | try: |
|
542 | 541 | contenders.update(set(h.files())) |
|
543 | 542 | except AttributeError: |
|
544 | 543 | pass |
|
545 | 544 | |
|
546 | 545 | changed = status.modified + status.added + status.removed |
|
547 | 546 | newfiles = [f for f in changed if f in contenders] |
|
548 | 547 | if not newfiles: |
|
549 | 548 | ui.status(_('no changes to record\n')) |
|
550 | 549 | return 0 |
|
551 | 550 | |
|
552 | 551 | modified = set(status.modified) |
|
553 | 552 | |
|
554 | 553 | # 2. backup changed files, so we can restore them in the end |
|
555 | 554 | if backupall: |
|
556 | 555 | tobackup = changed |
|
557 | 556 | else: |
|
558 | 557 | tobackup = [f for f in newfiles if f in modified] |
|
559 | 558 | |
|
560 | 559 | backups = {} |
|
561 | 560 | if tobackup: |
|
562 | 561 | backupdir = repo.join('record-backups') |
|
563 | 562 | try: |
|
564 | 563 | os.mkdir(backupdir) |
|
565 | 564 | except OSError, err: |
|
566 | 565 | if err.errno != errno.EEXIST: |
|
567 | 566 | raise |
|
568 | 567 | try: |
|
569 | 568 | # backup continues |
|
570 | 569 | for f in tobackup: |
|
571 | 570 | fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.', |
|
572 | 571 | dir=backupdir) |
|
573 | 572 | os.close(fd) |
|
574 | 573 | ui.debug('backup %r as %r\n' % (f, tmpname)) |
|
575 | 574 | util.copyfile(repo.wjoin(f), tmpname) |
|
576 | 575 | shutil.copystat(repo.wjoin(f), tmpname) |
|
577 | 576 | backups[f] = tmpname |
|
578 | 577 | |
|
579 | 578 | fp = cStringIO.StringIO() |
|
580 | 579 | for c in chunks: |
|
581 | 580 | if c.filename() in backups: |
|
582 | 581 | c.write(fp) |
|
583 | 582 | dopatch = fp.tell() |
|
584 | 583 | fp.seek(0) |
|
585 | 584 | |
|
586 | 585 | # 3a. apply filtered patch to clean repo (clean) |
|
587 | 586 | if backups: |
|
588 | 587 | hg.revert(repo, repo.dirstate.p1(), |
|
589 | 588 | lambda key: key in backups) |
|
590 | 589 | |
|
591 | 590 | # 3b. (apply) |
|
592 | 591 | if dopatch: |
|
593 | 592 | try: |
|
594 | 593 | ui.debug('applying patch\n') |
|
595 | 594 | ui.debug(fp.getvalue()) |
|
596 | 595 | patch.internalpatch(ui, repo, fp, 1, eolmode=None) |
|
597 | 596 | except patch.PatchError, err: |
|
598 | 597 | raise util.Abort(str(err)) |
|
599 | 598 | del fp |
|
600 | 599 | |
|
601 | 600 | # 4. We prepared working directory according to filtered |
|
602 | 601 | # patch. Now is the time to delegate the job to |
|
603 | 602 | # commit/qrefresh or the like! |
|
604 | 603 | |
|
605 | 604 | # Make all of the pathnames absolute. |
|
606 | 605 | newfiles = [repo.wjoin(nf) for nf in newfiles] |
|
607 | 606 | commitfunc(ui, repo, *newfiles, **opts) |
|
608 | 607 | |
|
609 | 608 | return 0 |
|
610 | 609 | finally: |
|
611 | 610 | # 5. finally restore backed-up files |
|
612 | 611 | try: |
|
613 | 612 | for realname, tmpname in backups.iteritems(): |
|
614 | 613 | ui.debug('restoring %r to %r\n' % (tmpname, realname)) |
|
615 | 614 | util.copyfile(tmpname, repo.wjoin(realname)) |
|
616 | 615 | # Our calls to copystat() here and above are a |
|
617 | 616 | # hack to trick any editors that have f open that |
|
618 | 617 | # we haven't modified them. |
|
619 | 618 | # |
|
620 | 619 | # Also note that this racy as an editor could |
|
621 | 620 | # notice the file's mtime before we've finished |
|
622 | 621 | # writing it. |
|
623 | 622 | shutil.copystat(tmpname, repo.wjoin(realname)) |
|
624 | 623 | os.unlink(tmpname) |
|
625 | 624 | if tobackup: |
|
626 | 625 | os.rmdir(backupdir) |
|
627 | 626 | except OSError: |
|
628 | 627 | pass |
|
629 | 628 | |
|
630 | 629 | # wrap ui.write so diff output can be labeled/colorized |
|
631 | 630 | def wrapwrite(orig, *args, **kw): |
|
632 | 631 | label = kw.pop('label', '') |
|
633 | 632 | for chunk, l in patch.difflabel(lambda: args): |
|
634 | 633 | orig(chunk, label=label + l) |
|
635 | 634 | oldwrite = ui.write |
|
636 | 635 | extensions.wrapfunction(ui, 'write', wrapwrite) |
|
637 | 636 | try: |
|
638 | 637 | return cmdutil.commit(ui, repo, recordfunc, pats, opts) |
|
639 | 638 | finally: |
|
640 | 639 | ui.write = oldwrite |
|
641 | 640 | |
|
642 | 641 | def uisetup(ui): |
|
643 | 642 | try: |
|
644 | 643 | mq = extensions.find('mq') |
|
645 | 644 | except KeyError: |
|
646 | 645 | return |
|
647 | 646 | |
|
648 | 647 | cmdtable["qrecord"] = \ |
|
649 | 648 | (qrecord, |
|
650 | 649 | # same options as qnew, but copy them so we don't get |
|
651 | 650 | # -i/--interactive for qrecord and add white space diff options |
|
652 | 651 | mq.cmdtable['^qnew'][1][:] + commands.diffwsopts, |
|
653 | 652 | _('hg qrecord [OPTION]... PATCH [FILE]...')) |
|
654 | 653 | |
|
655 | 654 | _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch")) |
|
656 | 655 | _wrapcmd('qrefresh', mq.cmdtable, qrefresh, |
|
657 | 656 | _("interactively select changes to refresh")) |
|
658 | 657 | |
|
659 | 658 | def _wrapcmd(cmd, table, wrapfn, msg): |
|
660 | 659 | entry = extensions.wrapcommand(table, cmd, wrapfn) |
|
661 | 660 | entry[1].append(('i', 'interactive', None, msg)) |
@@ -1,1379 +1,1379 b'' | |||
|
1 | 1 | Set up a repo |
|
2 | 2 | |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [ui] |
|
5 | 5 | > interactive = true |
|
6 | 6 | > [extensions] |
|
7 | 7 | > record = |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | $ hg init a |
|
11 | 11 | $ cd a |
|
12 | 12 | |
|
13 | 13 | Select no files |
|
14 | 14 | |
|
15 | 15 | $ touch empty-rw |
|
16 | 16 | $ hg add empty-rw |
|
17 | 17 | |
|
18 | 18 | $ hg record empty-rw<<EOF |
|
19 | 19 | > n |
|
20 | 20 | > EOF |
|
21 | 21 | diff --git a/empty-rw b/empty-rw |
|
22 | 22 | new file mode 100644 |
|
23 | 23 | examine changes to 'empty-rw'? [Ynesfdaq?] n |
|
24 | 24 | |
|
25 | 25 | no changes to record |
|
26 | 26 | |
|
27 | 27 | $ hg tip -p |
|
28 | 28 | changeset: -1:000000000000 |
|
29 | 29 | tag: tip |
|
30 | 30 | user: |
|
31 | 31 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | Select files but no hunks |
|
36 | 36 | |
|
37 | 37 | $ hg record empty-rw<<EOF |
|
38 | 38 | > y |
|
39 | 39 | > n |
|
40 | 40 | > EOF |
|
41 | 41 | diff --git a/empty-rw b/empty-rw |
|
42 | 42 | new file mode 100644 |
|
43 | 43 | examine changes to 'empty-rw'? [Ynesfdaq?] y |
|
44 | 44 | |
|
45 | 45 | abort: empty commit message |
|
46 | 46 | [255] |
|
47 | 47 | |
|
48 | 48 | $ hg tip -p |
|
49 | 49 | changeset: -1:000000000000 |
|
50 | 50 | tag: tip |
|
51 | 51 | user: |
|
52 | 52 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | Record empty file |
|
57 | 57 | |
|
58 | 58 | $ hg record -d '0 0' -m empty empty-rw<<EOF |
|
59 | 59 | > y |
|
60 | 60 | > y |
|
61 | 61 | > EOF |
|
62 | 62 | diff --git a/empty-rw b/empty-rw |
|
63 | 63 | new file mode 100644 |
|
64 | 64 | examine changes to 'empty-rw'? [Ynesfdaq?] y |
|
65 | 65 | |
|
66 | 66 | |
|
67 | 67 | $ hg tip -p |
|
68 | 68 | changeset: 0:c0708cf4e46e |
|
69 | 69 | tag: tip |
|
70 | 70 | user: test |
|
71 | 71 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
72 | 72 | summary: empty |
|
73 | 73 | |
|
74 | 74 | |
|
75 | 75 | |
|
76 | 76 | Summary shows we updated to the new cset |
|
77 | 77 | |
|
78 | 78 | $ hg summary |
|
79 | 79 | parent: 0:c0708cf4e46e tip |
|
80 | 80 | empty |
|
81 | 81 | branch: default |
|
82 | 82 | commit: (clean) |
|
83 | 83 | update: (current) |
|
84 | 84 | |
|
85 | 85 | Rename empty file |
|
86 | 86 | |
|
87 | 87 | $ hg mv empty-rw empty-rename |
|
88 | 88 | $ hg record -d '1 0' -m rename<<EOF |
|
89 | 89 | > y |
|
90 | 90 | > EOF |
|
91 | 91 | diff --git a/empty-rw b/empty-rename |
|
92 | 92 | rename from empty-rw |
|
93 | 93 | rename to empty-rename |
|
94 | 94 | examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | $ hg tip -p |
|
98 | 98 | changeset: 1:d695e8dcb197 |
|
99 | 99 | tag: tip |
|
100 | 100 | user: test |
|
101 | 101 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
102 | 102 | summary: rename |
|
103 | 103 | |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | Copy empty file |
|
107 | 107 | |
|
108 | 108 | $ hg cp empty-rename empty-copy |
|
109 | 109 | $ hg record -d '2 0' -m copy<<EOF |
|
110 | 110 | > y |
|
111 | 111 | > EOF |
|
112 | 112 | diff --git a/empty-rename b/empty-copy |
|
113 | 113 | copy from empty-rename |
|
114 | 114 | copy to empty-copy |
|
115 | 115 | examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | $ hg tip -p |
|
119 | 119 | changeset: 2:1d4b90bea524 |
|
120 | 120 | tag: tip |
|
121 | 121 | user: test |
|
122 | 122 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
123 | 123 | summary: copy |
|
124 | 124 | |
|
125 | 125 | |
|
126 | 126 | |
|
127 | 127 | Delete empty file |
|
128 | 128 | |
|
129 | 129 | $ hg rm empty-copy |
|
130 | 130 | $ hg record -d '3 0' -m delete<<EOF |
|
131 | 131 | > y |
|
132 | 132 | > EOF |
|
133 | 133 | diff --git a/empty-copy b/empty-copy |
|
134 | 134 | deleted file mode 100644 |
|
135 | 135 | examine changes to 'empty-copy'? [Ynesfdaq?] y |
|
136 | 136 | |
|
137 | 137 | |
|
138 | 138 | $ hg tip -p |
|
139 | 139 | changeset: 3:b39a238f01a1 |
|
140 | 140 | tag: tip |
|
141 | 141 | user: test |
|
142 | 142 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
143 | 143 | summary: delete |
|
144 | 144 | |
|
145 | 145 | |
|
146 | 146 | |
|
147 | 147 | Add binary file |
|
148 | 148 | |
|
149 | 149 | $ hg bundle --base -2 tip.bundle |
|
150 | 150 | 1 changesets found |
|
151 | 151 | $ hg add tip.bundle |
|
152 | 152 | $ hg record -d '4 0' -m binary<<EOF |
|
153 | 153 | > y |
|
154 | 154 | > EOF |
|
155 | 155 | diff --git a/tip.bundle b/tip.bundle |
|
156 | 156 | new file mode 100644 |
|
157 | 157 | this is a binary file |
|
158 | 158 | examine changes to 'tip.bundle'? [Ynesfdaq?] y |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | $ hg tip -p |
|
162 | 162 | changeset: 4:ad816da3711e |
|
163 | 163 | tag: tip |
|
164 | 164 | user: test |
|
165 | 165 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
166 | 166 | summary: binary |
|
167 | 167 | |
|
168 | 168 | diff -r b39a238f01a1 -r ad816da3711e tip.bundle |
|
169 | 169 | Binary file tip.bundle has changed |
|
170 | 170 | |
|
171 | 171 | |
|
172 | 172 | Change binary file |
|
173 | 173 | |
|
174 | 174 | $ hg bundle --base -2 tip.bundle |
|
175 | 175 | 1 changesets found |
|
176 | 176 | $ hg record -d '5 0' -m binary-change<<EOF |
|
177 | 177 | > y |
|
178 | 178 | > EOF |
|
179 | 179 | diff --git a/tip.bundle b/tip.bundle |
|
180 | 180 | this modifies a binary file (all or nothing) |
|
181 | 181 | examine changes to 'tip.bundle'? [Ynesfdaq?] y |
|
182 | 182 | |
|
183 | 183 | |
|
184 | 184 | $ hg tip -p |
|
185 | 185 | changeset: 5:dccd6f3eb485 |
|
186 | 186 | tag: tip |
|
187 | 187 | user: test |
|
188 | 188 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
189 | 189 | summary: binary-change |
|
190 | 190 | |
|
191 | 191 | diff -r ad816da3711e -r dccd6f3eb485 tip.bundle |
|
192 | 192 | Binary file tip.bundle has changed |
|
193 | 193 | |
|
194 | 194 | |
|
195 | 195 | Rename and change binary file |
|
196 | 196 | |
|
197 | 197 | $ hg mv tip.bundle top.bundle |
|
198 | 198 | $ hg bundle --base -2 top.bundle |
|
199 | 199 | 1 changesets found |
|
200 | 200 | $ hg record -d '6 0' -m binary-change-rename<<EOF |
|
201 | 201 | > y |
|
202 | 202 | > EOF |
|
203 | 203 | diff --git a/tip.bundle b/top.bundle |
|
204 | 204 | rename from tip.bundle |
|
205 | 205 | rename to top.bundle |
|
206 | 206 | this modifies a binary file (all or nothing) |
|
207 | 207 | examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y |
|
208 | 208 | |
|
209 | 209 | |
|
210 | 210 | $ hg tip -p |
|
211 | 211 | changeset: 6:7fa44105f5b3 |
|
212 | 212 | tag: tip |
|
213 | 213 | user: test |
|
214 | 214 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
215 | 215 | summary: binary-change-rename |
|
216 | 216 | |
|
217 | 217 | diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle |
|
218 | 218 | Binary file tip.bundle has changed |
|
219 | 219 | diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle |
|
220 | 220 | Binary file top.bundle has changed |
|
221 | 221 | |
|
222 | 222 | |
|
223 | 223 | Add plain file |
|
224 | 224 | |
|
225 | 225 | $ for i in 1 2 3 4 5 6 7 8 9 10; do |
|
226 | 226 | > echo $i >> plain |
|
227 | 227 | > done |
|
228 | 228 | |
|
229 | 229 | $ hg add plain |
|
230 | 230 | $ hg record -d '7 0' -m plain plain<<EOF |
|
231 | 231 | > y |
|
232 | 232 | > y |
|
233 | 233 | > EOF |
|
234 | 234 | diff --git a/plain b/plain |
|
235 | 235 | new file mode 100644 |
|
236 | 236 | examine changes to 'plain'? [Ynesfdaq?] y |
|
237 | 237 | |
|
238 | 238 | |
|
239 | 239 | $ hg tip -p |
|
240 | 240 | changeset: 7:11fb457c1be4 |
|
241 | 241 | tag: tip |
|
242 | 242 | user: test |
|
243 | 243 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
244 | 244 | summary: plain |
|
245 | 245 | |
|
246 | 246 | diff -r 7fa44105f5b3 -r 11fb457c1be4 plain |
|
247 | 247 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
248 | 248 | +++ b/plain Thu Jan 01 00:00:07 1970 +0000 |
|
249 | 249 | @@ -0,0 +1,10 @@ |
|
250 | 250 | +1 |
|
251 | 251 | +2 |
|
252 | 252 | +3 |
|
253 | 253 | +4 |
|
254 | 254 | +5 |
|
255 | 255 | +6 |
|
256 | 256 | +7 |
|
257 | 257 | +8 |
|
258 | 258 | +9 |
|
259 | 259 | +10 |
|
260 | 260 | |
|
261 | 261 | Modify end of plain file with username unset |
|
262 | 262 | |
|
263 | 263 | $ echo 11 >> plain |
|
264 | 264 | $ unset HGUSER |
|
265 | 265 | $ hg record --config ui.username= -d '8 0' -m end plain |
|
266 | 266 | abort: no username supplied |
|
267 | 267 | (use "hg config --edit" to set your username) |
|
268 | 268 | [255] |
|
269 | 269 | |
|
270 | 270 | |
|
271 | 271 | Modify end of plain file, also test that diffopts are accounted for |
|
272 | 272 | |
|
273 | 273 | $ HGUSER="test" |
|
274 | 274 | $ export HGUSER |
|
275 | 275 | $ hg record --config diff.showfunc=true -d '8 0' -m end plain <<EOF |
|
276 | 276 | > y |
|
277 | 277 | > y |
|
278 | 278 | > EOF |
|
279 | 279 | diff --git a/plain b/plain |
|
280 | 280 | 1 hunks, 1 lines changed |
|
281 | 281 | examine changes to 'plain'? [Ynesfdaq?] y |
|
282 | 282 | |
|
283 | 283 | @@ -8,3 +8,4 @@ 7 |
|
284 | 284 | 8 |
|
285 | 285 | 9 |
|
286 | 286 | 10 |
|
287 | 287 | +11 |
|
288 | 288 | record this change to 'plain'? [Ynesfdaq?] y |
|
289 | 289 | |
|
290 | 290 | |
|
291 | 291 | Modify end of plain file, no EOL |
|
292 | 292 | |
|
293 | 293 | $ hg tip --template '{node}' >> plain |
|
294 | 294 | $ hg record -d '9 0' -m noeol plain <<EOF |
|
295 | 295 | > y |
|
296 | 296 | > y |
|
297 | 297 | > EOF |
|
298 | 298 | diff --git a/plain b/plain |
|
299 | 299 | 1 hunks, 1 lines changed |
|
300 | 300 | examine changes to 'plain'? [Ynesfdaq?] y |
|
301 | 301 | |
|
302 | 302 | @@ -9,3 +9,4 @@ |
|
303 | 303 | 9 |
|
304 | 304 | 10 |
|
305 | 305 | 11 |
|
306 | 306 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
307 | 307 | \ No newline at end of file |
|
308 | 308 | record this change to 'plain'? [Ynesfdaq?] y |
|
309 | 309 | |
|
310 | 310 | |
|
311 | 311 | Modify end of plain file, add EOL |
|
312 | 312 | |
|
313 | 313 | $ echo >> plain |
|
314 | 314 | $ echo 1 > plain2 |
|
315 | 315 | $ hg add plain2 |
|
316 | 316 | $ hg record -d '10 0' -m eol plain plain2 <<EOF |
|
317 | 317 | > y |
|
318 | 318 | > y |
|
319 | 319 | > y |
|
320 | 320 | > EOF |
|
321 | 321 | diff --git a/plain b/plain |
|
322 | 322 | 1 hunks, 1 lines changed |
|
323 | 323 | examine changes to 'plain'? [Ynesfdaq?] y |
|
324 | 324 | |
|
325 | 325 | @@ -9,4 +9,4 @@ |
|
326 | 326 | 9 |
|
327 | 327 | 10 |
|
328 | 328 | 11 |
|
329 | 329 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
330 | 330 | \ No newline at end of file |
|
331 | 331 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
332 | 332 | record change 1/2 to 'plain'? [Ynesfdaq?] y |
|
333 | 333 | |
|
334 | 334 | diff --git a/plain2 b/plain2 |
|
335 | 335 | new file mode 100644 |
|
336 | 336 | examine changes to 'plain2'? [Ynesfdaq?] y |
|
337 | 337 | |
|
338 | 338 | |
|
339 | 339 | Modify beginning, trim end, record both, add another file to test |
|
340 | 340 | changes numbering |
|
341 | 341 | |
|
342 | 342 | $ rm plain |
|
343 | 343 | $ for i in 2 2 3 4 5 6 7 8 9 10; do |
|
344 | 344 | > echo $i >> plain |
|
345 | 345 | > done |
|
346 | 346 | $ echo 2 >> plain2 |
|
347 | 347 | |
|
348 | 348 | $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF |
|
349 | 349 | > y |
|
350 | 350 | > y |
|
351 | 351 | > y |
|
352 | 352 | > y |
|
353 | 353 | > y |
|
354 | 354 | > EOF |
|
355 | 355 | diff --git a/plain b/plain |
|
356 | 356 | 2 hunks, 3 lines changed |
|
357 | 357 | examine changes to 'plain'? [Ynesfdaq?] y |
|
358 | 358 | |
|
359 | 359 | @@ -1,4 +1,4 @@ |
|
360 | 360 | -1 |
|
361 | 361 | +2 |
|
362 | 362 | 2 |
|
363 | 363 | 3 |
|
364 | 364 | 4 |
|
365 | 365 | record change 1/3 to 'plain'? [Ynesfdaq?] y |
|
366 | 366 | |
|
367 | 367 | @@ -8,5 +8,3 @@ |
|
368 | 368 | 8 |
|
369 | 369 | 9 |
|
370 | 370 | 10 |
|
371 | 371 | -11 |
|
372 | 372 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
373 | 373 | record change 2/3 to 'plain'? [Ynesfdaq?] y |
|
374 | 374 | |
|
375 | 375 | diff --git a/plain2 b/plain2 |
|
376 | 376 | 1 hunks, 1 lines changed |
|
377 | 377 | examine changes to 'plain2'? [Ynesfdaq?] y |
|
378 | 378 | |
|
379 | 379 | @@ -1,1 +1,2 @@ |
|
380 | 380 | 1 |
|
381 | 381 | +2 |
|
382 | 382 | record change 3/3 to 'plain2'? [Ynesfdaq?] y |
|
383 | 383 | |
|
384 | 384 | |
|
385 | 385 | $ hg tip -p |
|
386 | 386 | changeset: 11:21df83db12b8 |
|
387 | 387 | tag: tip |
|
388 | 388 | user: test |
|
389 | 389 | date: Thu Jan 01 00:00:10 1970 +0000 |
|
390 | 390 | summary: begin-and-end |
|
391 | 391 | |
|
392 | 392 | diff -r ddb8b281c3ff -r 21df83db12b8 plain |
|
393 | 393 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
394 | 394 | +++ b/plain Thu Jan 01 00:00:10 1970 +0000 |
|
395 | 395 | @@ -1,4 +1,4 @@ |
|
396 | 396 | -1 |
|
397 | 397 | +2 |
|
398 | 398 | 2 |
|
399 | 399 | 3 |
|
400 | 400 | 4 |
|
401 | 401 | @@ -8,5 +8,3 @@ |
|
402 | 402 | 8 |
|
403 | 403 | 9 |
|
404 | 404 | 10 |
|
405 | 405 | -11 |
|
406 | 406 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
407 | 407 | diff -r ddb8b281c3ff -r 21df83db12b8 plain2 |
|
408 | 408 | --- a/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
409 | 409 | +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
410 | 410 | @@ -1,1 +1,2 @@ |
|
411 | 411 | 1 |
|
412 | 412 | +2 |
|
413 | 413 | |
|
414 | 414 | |
|
415 | 415 | Trim beginning, modify end |
|
416 | 416 | |
|
417 | 417 | $ rm plain |
|
418 | 418 | > for i in 4 5 6 7 8 9 10.new; do |
|
419 | 419 | > echo $i >> plain |
|
420 | 420 | > done |
|
421 | 421 | |
|
422 | 422 | Record end |
|
423 | 423 | |
|
424 | 424 | $ hg record -d '11 0' -m end-only plain <<EOF |
|
425 | 425 | > y |
|
426 | 426 | > n |
|
427 | 427 | > y |
|
428 | 428 | > EOF |
|
429 | 429 | diff --git a/plain b/plain |
|
430 | 430 | 2 hunks, 4 lines changed |
|
431 | 431 | examine changes to 'plain'? [Ynesfdaq?] y |
|
432 | 432 | |
|
433 | 433 | @@ -1,9 +1,6 @@ |
|
434 | 434 | -2 |
|
435 | 435 | -2 |
|
436 | 436 | -3 |
|
437 | 437 | 4 |
|
438 | 438 | 5 |
|
439 | 439 | 6 |
|
440 | 440 | 7 |
|
441 | 441 | 8 |
|
442 | 442 | 9 |
|
443 | 443 | record change 1/2 to 'plain'? [Ynesfdaq?] n |
|
444 | 444 | |
|
445 | 445 | @@ -4,7 +1,7 @@ |
|
446 | 446 | 4 |
|
447 | 447 | 5 |
|
448 | 448 | 6 |
|
449 | 449 | 7 |
|
450 | 450 | 8 |
|
451 | 451 | 9 |
|
452 | 452 | -10 |
|
453 | 453 | +10.new |
|
454 | 454 | record change 2/2 to 'plain'? [Ynesfdaq?] y |
|
455 | 455 | |
|
456 | 456 | |
|
457 | 457 | $ hg tip -p |
|
458 | 458 | changeset: 12:99337501826f |
|
459 | 459 | tag: tip |
|
460 | 460 | user: test |
|
461 | 461 | date: Thu Jan 01 00:00:11 1970 +0000 |
|
462 | 462 | summary: end-only |
|
463 | 463 | |
|
464 | 464 | diff -r 21df83db12b8 -r 99337501826f plain |
|
465 | 465 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
466 | 466 | +++ b/plain Thu Jan 01 00:00:11 1970 +0000 |
|
467 | 467 | @@ -7,4 +7,4 @@ |
|
468 | 468 | 7 |
|
469 | 469 | 8 |
|
470 | 470 | 9 |
|
471 | 471 | -10 |
|
472 | 472 | +10.new |
|
473 | 473 | |
|
474 | 474 | |
|
475 | 475 | Record beginning |
|
476 | 476 | |
|
477 | 477 | $ hg record -d '12 0' -m begin-only plain <<EOF |
|
478 | 478 | > y |
|
479 | 479 | > y |
|
480 | 480 | > EOF |
|
481 | 481 | diff --git a/plain b/plain |
|
482 | 482 | 1 hunks, 3 lines changed |
|
483 | 483 | examine changes to 'plain'? [Ynesfdaq?] y |
|
484 | 484 | |
|
485 | 485 | @@ -1,6 +1,3 @@ |
|
486 | 486 | -2 |
|
487 | 487 | -2 |
|
488 | 488 | -3 |
|
489 | 489 | 4 |
|
490 | 490 | 5 |
|
491 | 491 | 6 |
|
492 | 492 | record this change to 'plain'? [Ynesfdaq?] y |
|
493 | 493 | |
|
494 | 494 | |
|
495 | 495 | $ hg tip -p |
|
496 | 496 | changeset: 13:bbd45465d540 |
|
497 | 497 | tag: tip |
|
498 | 498 | user: test |
|
499 | 499 | date: Thu Jan 01 00:00:12 1970 +0000 |
|
500 | 500 | summary: begin-only |
|
501 | 501 | |
|
502 | 502 | diff -r 99337501826f -r bbd45465d540 plain |
|
503 | 503 | --- a/plain Thu Jan 01 00:00:11 1970 +0000 |
|
504 | 504 | +++ b/plain Thu Jan 01 00:00:12 1970 +0000 |
|
505 | 505 | @@ -1,6 +1,3 @@ |
|
506 | 506 | -2 |
|
507 | 507 | -2 |
|
508 | 508 | -3 |
|
509 | 509 | 4 |
|
510 | 510 | 5 |
|
511 | 511 | 6 |
|
512 | 512 | |
|
513 | 513 | |
|
514 | 514 | Add to beginning, trim from end |
|
515 | 515 | |
|
516 | 516 | $ rm plain |
|
517 | 517 | $ for i in 1 2 3 4 5 6 7 8 9; do |
|
518 | 518 | > echo $i >> plain |
|
519 | 519 | > done |
|
520 | 520 | |
|
521 | 521 | Record end |
|
522 | 522 | |
|
523 | 523 | $ hg record --traceback -d '13 0' -m end-again plain<<EOF |
|
524 | 524 | > y |
|
525 | 525 | > n |
|
526 | 526 | > y |
|
527 | 527 | > EOF |
|
528 | 528 | diff --git a/plain b/plain |
|
529 | 529 | 2 hunks, 4 lines changed |
|
530 | 530 | examine changes to 'plain'? [Ynesfdaq?] y |
|
531 | 531 | |
|
532 | 532 | @@ -1,6 +1,9 @@ |
|
533 | 533 | +1 |
|
534 | 534 | +2 |
|
535 | 535 | +3 |
|
536 | 536 | 4 |
|
537 | 537 | 5 |
|
538 | 538 | 6 |
|
539 | 539 | 7 |
|
540 | 540 | 8 |
|
541 | 541 | 9 |
|
542 | 542 | record change 1/2 to 'plain'? [Ynesfdaq?] n |
|
543 | 543 | |
|
544 | 544 | @@ -1,7 +4,6 @@ |
|
545 | 545 | 4 |
|
546 | 546 | 5 |
|
547 | 547 | 6 |
|
548 | 548 | 7 |
|
549 | 549 | 8 |
|
550 | 550 | 9 |
|
551 | 551 | -10.new |
|
552 | 552 | record change 2/2 to 'plain'? [Ynesfdaq?] y |
|
553 | 553 | |
|
554 | 554 | |
|
555 | 555 | Add to beginning, middle, end |
|
556 | 556 | |
|
557 | 557 | $ rm plain |
|
558 | 558 | $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do |
|
559 | 559 | > echo $i >> plain |
|
560 | 560 | > done |
|
561 | 561 | |
|
562 | Record beginning, middle | |
|
562 | Record beginning, middle, and test that format-breaking diffopts are ignored | |
|
563 | 563 | |
|
564 | $ hg record -d '14 0' -m middle-only plain <<EOF | |
|
564 | $ hg record --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF | |
|
565 | 565 | > y |
|
566 | 566 | > y |
|
567 | 567 | > y |
|
568 | 568 | > n |
|
569 | 569 | > EOF |
|
570 | 570 | diff --git a/plain b/plain |
|
571 | 571 | 3 hunks, 7 lines changed |
|
572 | 572 | examine changes to 'plain'? [Ynesfdaq?] y |
|
573 | 573 | |
|
574 | 574 | @@ -1,2 +1,5 @@ |
|
575 | 575 | +1 |
|
576 | 576 | +2 |
|
577 | 577 | +3 |
|
578 | 578 | 4 |
|
579 | 579 | 5 |
|
580 | 580 | record change 1/3 to 'plain'? [Ynesfdaq?] y |
|
581 | 581 | |
|
582 | 582 | @@ -1,6 +4,8 @@ |
|
583 | 583 | 4 |
|
584 | 584 | 5 |
|
585 | 585 | +5.new |
|
586 | 586 | +5.reallynew |
|
587 | 587 | 6 |
|
588 | 588 | 7 |
|
589 | 589 | 8 |
|
590 | 590 | 9 |
|
591 | 591 | record change 2/3 to 'plain'? [Ynesfdaq?] y |
|
592 | 592 | |
|
593 | 593 | @@ -3,4 +8,6 @@ |
|
594 | 594 | 6 |
|
595 | 595 | 7 |
|
596 | 596 | 8 |
|
597 | 597 | 9 |
|
598 | 598 | +10 |
|
599 | 599 | +11 |
|
600 | 600 | record change 3/3 to 'plain'? [Ynesfdaq?] n |
|
601 | 601 | |
|
602 | 602 | |
|
603 | 603 | $ hg tip -p |
|
604 | 604 | changeset: 15:f34a7937ec33 |
|
605 | 605 | tag: tip |
|
606 | 606 | user: test |
|
607 | 607 | date: Thu Jan 01 00:00:14 1970 +0000 |
|
608 | 608 | summary: middle-only |
|
609 | 609 | |
|
610 | 610 | diff -r 82c065d0b850 -r f34a7937ec33 plain |
|
611 | 611 | --- a/plain Thu Jan 01 00:00:13 1970 +0000 |
|
612 | 612 | +++ b/plain Thu Jan 01 00:00:14 1970 +0000 |
|
613 | 613 | @@ -1,5 +1,10 @@ |
|
614 | 614 | +1 |
|
615 | 615 | +2 |
|
616 | 616 | +3 |
|
617 | 617 | 4 |
|
618 | 618 | 5 |
|
619 | 619 | +5.new |
|
620 | 620 | +5.reallynew |
|
621 | 621 | 6 |
|
622 | 622 | 7 |
|
623 | 623 | 8 |
|
624 | 624 | |
|
625 | 625 | |
|
626 | 626 | Record end |
|
627 | 627 | |
|
628 | 628 | $ hg record -d '15 0' -m end-only plain <<EOF |
|
629 | 629 | > y |
|
630 | 630 | > y |
|
631 | 631 | > EOF |
|
632 | 632 | diff --git a/plain b/plain |
|
633 | 633 | 1 hunks, 2 lines changed |
|
634 | 634 | examine changes to 'plain'? [Ynesfdaq?] y |
|
635 | 635 | |
|
636 | 636 | @@ -9,3 +9,5 @@ |
|
637 | 637 | 7 |
|
638 | 638 | 8 |
|
639 | 639 | 9 |
|
640 | 640 | +10 |
|
641 | 641 | +11 |
|
642 | 642 | record this change to 'plain'? [Ynesfdaq?] y |
|
643 | 643 | |
|
644 | 644 | |
|
645 | 645 | $ hg tip -p |
|
646 | 646 | changeset: 16:f9900b71a04c |
|
647 | 647 | tag: tip |
|
648 | 648 | user: test |
|
649 | 649 | date: Thu Jan 01 00:00:15 1970 +0000 |
|
650 | 650 | summary: end-only |
|
651 | 651 | |
|
652 | 652 | diff -r f34a7937ec33 -r f9900b71a04c plain |
|
653 | 653 | --- a/plain Thu Jan 01 00:00:14 1970 +0000 |
|
654 | 654 | +++ b/plain Thu Jan 01 00:00:15 1970 +0000 |
|
655 | 655 | @@ -9,3 +9,5 @@ |
|
656 | 656 | 7 |
|
657 | 657 | 8 |
|
658 | 658 | 9 |
|
659 | 659 | +10 |
|
660 | 660 | +11 |
|
661 | 661 | |
|
662 | 662 | |
|
663 | 663 | $ mkdir subdir |
|
664 | 664 | $ cd subdir |
|
665 | 665 | $ echo a > a |
|
666 | 666 | $ hg ci -d '16 0' -Amsubdir |
|
667 | 667 | adding subdir/a |
|
668 | 668 | |
|
669 | 669 | $ echo a >> a |
|
670 | 670 | $ hg record -d '16 0' -m subdir-change a <<EOF |
|
671 | 671 | > y |
|
672 | 672 | > y |
|
673 | 673 | > EOF |
|
674 | 674 | diff --git a/subdir/a b/subdir/a |
|
675 | 675 | 1 hunks, 1 lines changed |
|
676 | 676 | examine changes to 'subdir/a'? [Ynesfdaq?] y |
|
677 | 677 | |
|
678 | 678 | @@ -1,1 +1,2 @@ |
|
679 | 679 | a |
|
680 | 680 | +a |
|
681 | 681 | record this change to 'subdir/a'? [Ynesfdaq?] y |
|
682 | 682 | |
|
683 | 683 | |
|
684 | 684 | $ hg tip -p |
|
685 | 685 | changeset: 18:61be427a9deb |
|
686 | 686 | tag: tip |
|
687 | 687 | user: test |
|
688 | 688 | date: Thu Jan 01 00:00:16 1970 +0000 |
|
689 | 689 | summary: subdir-change |
|
690 | 690 | |
|
691 | 691 | diff -r a7ffae4d61cb -r 61be427a9deb subdir/a |
|
692 | 692 | --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
693 | 693 | +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
694 | 694 | @@ -1,1 +1,2 @@ |
|
695 | 695 | a |
|
696 | 696 | +a |
|
697 | 697 | |
|
698 | 698 | |
|
699 | 699 | $ echo a > f1 |
|
700 | 700 | $ echo b > f2 |
|
701 | 701 | $ hg add f1 f2 |
|
702 | 702 | |
|
703 | 703 | $ hg ci -mz -d '17 0' |
|
704 | 704 | |
|
705 | 705 | $ echo a >> f1 |
|
706 | 706 | $ echo b >> f2 |
|
707 | 707 | |
|
708 | 708 | Help, quit |
|
709 | 709 | |
|
710 | 710 | $ hg record <<EOF |
|
711 | 711 | > ? |
|
712 | 712 | > q |
|
713 | 713 | > EOF |
|
714 | 714 | diff --git a/subdir/f1 b/subdir/f1 |
|
715 | 715 | 1 hunks, 1 lines changed |
|
716 | 716 | examine changes to 'subdir/f1'? [Ynesfdaq?] ? |
|
717 | 717 | |
|
718 | 718 | y - yes, record this change |
|
719 | 719 | n - no, skip this change |
|
720 | 720 | e - edit this change manually |
|
721 | 721 | s - skip remaining changes to this file |
|
722 | 722 | f - record remaining changes to this file |
|
723 | 723 | d - done, skip remaining changes and files |
|
724 | 724 | a - record all changes to all remaining files |
|
725 | 725 | q - quit, recording no changes |
|
726 | 726 | ? - ? (display help) |
|
727 | 727 | examine changes to 'subdir/f1'? [Ynesfdaq?] q |
|
728 | 728 | |
|
729 | 729 | abort: user quit |
|
730 | 730 | [255] |
|
731 | 731 | |
|
732 | 732 | Skip |
|
733 | 733 | |
|
734 | 734 | $ hg record <<EOF |
|
735 | 735 | > s |
|
736 | 736 | > EOF |
|
737 | 737 | diff --git a/subdir/f1 b/subdir/f1 |
|
738 | 738 | 1 hunks, 1 lines changed |
|
739 | 739 | examine changes to 'subdir/f1'? [Ynesfdaq?] s |
|
740 | 740 | |
|
741 | 741 | diff --git a/subdir/f2 b/subdir/f2 |
|
742 | 742 | 1 hunks, 1 lines changed |
|
743 | 743 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
744 | 744 | [255] |
|
745 | 745 | |
|
746 | 746 | No |
|
747 | 747 | |
|
748 | 748 | $ hg record <<EOF |
|
749 | 749 | > n |
|
750 | 750 | > EOF |
|
751 | 751 | diff --git a/subdir/f1 b/subdir/f1 |
|
752 | 752 | 1 hunks, 1 lines changed |
|
753 | 753 | examine changes to 'subdir/f1'? [Ynesfdaq?] n |
|
754 | 754 | |
|
755 | 755 | diff --git a/subdir/f2 b/subdir/f2 |
|
756 | 756 | 1 hunks, 1 lines changed |
|
757 | 757 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
758 | 758 | [255] |
|
759 | 759 | |
|
760 | 760 | f, quit |
|
761 | 761 | |
|
762 | 762 | $ hg record <<EOF |
|
763 | 763 | > f |
|
764 | 764 | > q |
|
765 | 765 | > EOF |
|
766 | 766 | diff --git a/subdir/f1 b/subdir/f1 |
|
767 | 767 | 1 hunks, 1 lines changed |
|
768 | 768 | examine changes to 'subdir/f1'? [Ynesfdaq?] f |
|
769 | 769 | |
|
770 | 770 | diff --git a/subdir/f2 b/subdir/f2 |
|
771 | 771 | 1 hunks, 1 lines changed |
|
772 | 772 | examine changes to 'subdir/f2'? [Ynesfdaq?] q |
|
773 | 773 | |
|
774 | 774 | abort: user quit |
|
775 | 775 | [255] |
|
776 | 776 | |
|
777 | 777 | s, all |
|
778 | 778 | |
|
779 | 779 | $ hg record -d '18 0' -mx <<EOF |
|
780 | 780 | > s |
|
781 | 781 | > a |
|
782 | 782 | > EOF |
|
783 | 783 | diff --git a/subdir/f1 b/subdir/f1 |
|
784 | 784 | 1 hunks, 1 lines changed |
|
785 | 785 | examine changes to 'subdir/f1'? [Ynesfdaq?] s |
|
786 | 786 | |
|
787 | 787 | diff --git a/subdir/f2 b/subdir/f2 |
|
788 | 788 | 1 hunks, 1 lines changed |
|
789 | 789 | examine changes to 'subdir/f2'? [Ynesfdaq?] a |
|
790 | 790 | |
|
791 | 791 | |
|
792 | 792 | $ hg tip -p |
|
793 | 793 | changeset: 20:b3df3dda369a |
|
794 | 794 | tag: tip |
|
795 | 795 | user: test |
|
796 | 796 | date: Thu Jan 01 00:00:18 1970 +0000 |
|
797 | 797 | summary: x |
|
798 | 798 | |
|
799 | 799 | diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2 |
|
800 | 800 | --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000 |
|
801 | 801 | +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000 |
|
802 | 802 | @@ -1,1 +1,2 @@ |
|
803 | 803 | b |
|
804 | 804 | +b |
|
805 | 805 | |
|
806 | 806 | |
|
807 | 807 | f |
|
808 | 808 | |
|
809 | 809 | $ hg record -d '19 0' -my <<EOF |
|
810 | 810 | > f |
|
811 | 811 | > EOF |
|
812 | 812 | diff --git a/subdir/f1 b/subdir/f1 |
|
813 | 813 | 1 hunks, 1 lines changed |
|
814 | 814 | examine changes to 'subdir/f1'? [Ynesfdaq?] f |
|
815 | 815 | |
|
816 | 816 | |
|
817 | 817 | $ hg tip -p |
|
818 | 818 | changeset: 21:38ec577f126b |
|
819 | 819 | tag: tip |
|
820 | 820 | user: test |
|
821 | 821 | date: Thu Jan 01 00:00:19 1970 +0000 |
|
822 | 822 | summary: y |
|
823 | 823 | |
|
824 | 824 | diff -r b3df3dda369a -r 38ec577f126b subdir/f1 |
|
825 | 825 | --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000 |
|
826 | 826 | +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000 |
|
827 | 827 | @@ -1,1 +1,2 @@ |
|
828 | 828 | a |
|
829 | 829 | +a |
|
830 | 830 | |
|
831 | 831 | |
|
832 | 832 | #if execbit |
|
833 | 833 | |
|
834 | 834 | Preserve chmod +x |
|
835 | 835 | |
|
836 | 836 | $ chmod +x f1 |
|
837 | 837 | $ echo a >> f1 |
|
838 | 838 | $ hg record -d '20 0' -mz <<EOF |
|
839 | 839 | > y |
|
840 | 840 | > y |
|
841 | 841 | > y |
|
842 | 842 | > EOF |
|
843 | 843 | diff --git a/subdir/f1 b/subdir/f1 |
|
844 | 844 | old mode 100644 |
|
845 | 845 | new mode 100755 |
|
846 | 846 | 1 hunks, 1 lines changed |
|
847 | 847 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
848 | 848 | |
|
849 | 849 | @@ -1,2 +1,3 @@ |
|
850 | 850 | a |
|
851 | 851 | a |
|
852 | 852 | +a |
|
853 | 853 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
854 | 854 | |
|
855 | 855 | |
|
856 | 856 | $ hg tip --config diff.git=True -p |
|
857 | 857 | changeset: 22:3261adceb075 |
|
858 | 858 | tag: tip |
|
859 | 859 | user: test |
|
860 | 860 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
861 | 861 | summary: z |
|
862 | 862 | |
|
863 | 863 | diff --git a/subdir/f1 b/subdir/f1 |
|
864 | 864 | old mode 100644 |
|
865 | 865 | new mode 100755 |
|
866 | 866 | --- a/subdir/f1 |
|
867 | 867 | +++ b/subdir/f1 |
|
868 | 868 | @@ -1,2 +1,3 @@ |
|
869 | 869 | a |
|
870 | 870 | a |
|
871 | 871 | +a |
|
872 | 872 | |
|
873 | 873 | |
|
874 | 874 | Preserve execute permission on original |
|
875 | 875 | |
|
876 | 876 | $ echo b >> f1 |
|
877 | 877 | $ hg record -d '21 0' -maa <<EOF |
|
878 | 878 | > y |
|
879 | 879 | > y |
|
880 | 880 | > y |
|
881 | 881 | > EOF |
|
882 | 882 | diff --git a/subdir/f1 b/subdir/f1 |
|
883 | 883 | 1 hunks, 1 lines changed |
|
884 | 884 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
885 | 885 | |
|
886 | 886 | @@ -1,3 +1,4 @@ |
|
887 | 887 | a |
|
888 | 888 | a |
|
889 | 889 | a |
|
890 | 890 | +b |
|
891 | 891 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
892 | 892 | |
|
893 | 893 | |
|
894 | 894 | $ hg tip --config diff.git=True -p |
|
895 | 895 | changeset: 23:b429867550db |
|
896 | 896 | tag: tip |
|
897 | 897 | user: test |
|
898 | 898 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
899 | 899 | summary: aa |
|
900 | 900 | |
|
901 | 901 | diff --git a/subdir/f1 b/subdir/f1 |
|
902 | 902 | --- a/subdir/f1 |
|
903 | 903 | +++ b/subdir/f1 |
|
904 | 904 | @@ -1,3 +1,4 @@ |
|
905 | 905 | a |
|
906 | 906 | a |
|
907 | 907 | a |
|
908 | 908 | +b |
|
909 | 909 | |
|
910 | 910 | |
|
911 | 911 | Preserve chmod -x |
|
912 | 912 | |
|
913 | 913 | $ chmod -x f1 |
|
914 | 914 | $ echo c >> f1 |
|
915 | 915 | $ hg record -d '22 0' -mab <<EOF |
|
916 | 916 | > y |
|
917 | 917 | > y |
|
918 | 918 | > y |
|
919 | 919 | > EOF |
|
920 | 920 | diff --git a/subdir/f1 b/subdir/f1 |
|
921 | 921 | old mode 100755 |
|
922 | 922 | new mode 100644 |
|
923 | 923 | 1 hunks, 1 lines changed |
|
924 | 924 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
925 | 925 | |
|
926 | 926 | @@ -2,3 +2,4 @@ |
|
927 | 927 | a |
|
928 | 928 | a |
|
929 | 929 | b |
|
930 | 930 | +c |
|
931 | 931 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
932 | 932 | |
|
933 | 933 | |
|
934 | 934 | $ hg tip --config diff.git=True -p |
|
935 | 935 | changeset: 24:0b082130c20a |
|
936 | 936 | tag: tip |
|
937 | 937 | user: test |
|
938 | 938 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
939 | 939 | summary: ab |
|
940 | 940 | |
|
941 | 941 | diff --git a/subdir/f1 b/subdir/f1 |
|
942 | 942 | old mode 100755 |
|
943 | 943 | new mode 100644 |
|
944 | 944 | --- a/subdir/f1 |
|
945 | 945 | +++ b/subdir/f1 |
|
946 | 946 | @@ -2,3 +2,4 @@ |
|
947 | 947 | a |
|
948 | 948 | a |
|
949 | 949 | b |
|
950 | 950 | +c |
|
951 | 951 | |
|
952 | 952 | |
|
953 | 953 | #else |
|
954 | 954 | |
|
955 | 955 | Slightly bogus tests to get almost same repo structure as when x bit is used |
|
956 | 956 | - but with different hashes. |
|
957 | 957 | |
|
958 | 958 | Mock "Preserve chmod +x" |
|
959 | 959 | |
|
960 | 960 | $ echo a >> f1 |
|
961 | 961 | $ hg record -d '20 0' -mz <<EOF |
|
962 | 962 | > y |
|
963 | 963 | > y |
|
964 | 964 | > y |
|
965 | 965 | > EOF |
|
966 | 966 | diff --git a/subdir/f1 b/subdir/f1 |
|
967 | 967 | 1 hunks, 1 lines changed |
|
968 | 968 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
969 | 969 | |
|
970 | 970 | @@ -1,2 +1,3 @@ |
|
971 | 971 | a |
|
972 | 972 | a |
|
973 | 973 | +a |
|
974 | 974 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
975 | 975 | |
|
976 | 976 | |
|
977 | 977 | $ hg tip --config diff.git=True -p |
|
978 | 978 | changeset: 22:0d463bd428f5 |
|
979 | 979 | tag: tip |
|
980 | 980 | user: test |
|
981 | 981 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
982 | 982 | summary: z |
|
983 | 983 | |
|
984 | 984 | diff --git a/subdir/f1 b/subdir/f1 |
|
985 | 985 | --- a/subdir/f1 |
|
986 | 986 | +++ b/subdir/f1 |
|
987 | 987 | @@ -1,2 +1,3 @@ |
|
988 | 988 | a |
|
989 | 989 | a |
|
990 | 990 | +a |
|
991 | 991 | |
|
992 | 992 | |
|
993 | 993 | Mock "Preserve execute permission on original" |
|
994 | 994 | |
|
995 | 995 | $ echo b >> f1 |
|
996 | 996 | $ hg record -d '21 0' -maa <<EOF |
|
997 | 997 | > y |
|
998 | 998 | > y |
|
999 | 999 | > y |
|
1000 | 1000 | > EOF |
|
1001 | 1001 | diff --git a/subdir/f1 b/subdir/f1 |
|
1002 | 1002 | 1 hunks, 1 lines changed |
|
1003 | 1003 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1004 | 1004 | |
|
1005 | 1005 | @@ -1,3 +1,4 @@ |
|
1006 | 1006 | a |
|
1007 | 1007 | a |
|
1008 | 1008 | a |
|
1009 | 1009 | +b |
|
1010 | 1010 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1011 | 1011 | |
|
1012 | 1012 | |
|
1013 | 1013 | $ hg tip --config diff.git=True -p |
|
1014 | 1014 | changeset: 23:0eab41a3e524 |
|
1015 | 1015 | tag: tip |
|
1016 | 1016 | user: test |
|
1017 | 1017 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
1018 | 1018 | summary: aa |
|
1019 | 1019 | |
|
1020 | 1020 | diff --git a/subdir/f1 b/subdir/f1 |
|
1021 | 1021 | --- a/subdir/f1 |
|
1022 | 1022 | +++ b/subdir/f1 |
|
1023 | 1023 | @@ -1,3 +1,4 @@ |
|
1024 | 1024 | a |
|
1025 | 1025 | a |
|
1026 | 1026 | a |
|
1027 | 1027 | +b |
|
1028 | 1028 | |
|
1029 | 1029 | |
|
1030 | 1030 | Mock "Preserve chmod -x" |
|
1031 | 1031 | |
|
1032 | 1032 | $ chmod -x f1 |
|
1033 | 1033 | $ echo c >> f1 |
|
1034 | 1034 | $ hg record -d '22 0' -mab <<EOF |
|
1035 | 1035 | > y |
|
1036 | 1036 | > y |
|
1037 | 1037 | > y |
|
1038 | 1038 | > EOF |
|
1039 | 1039 | diff --git a/subdir/f1 b/subdir/f1 |
|
1040 | 1040 | 1 hunks, 1 lines changed |
|
1041 | 1041 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1042 | 1042 | |
|
1043 | 1043 | @@ -2,3 +2,4 @@ |
|
1044 | 1044 | a |
|
1045 | 1045 | a |
|
1046 | 1046 | b |
|
1047 | 1047 | +c |
|
1048 | 1048 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1049 | 1049 | |
|
1050 | 1050 | |
|
1051 | 1051 | $ hg tip --config diff.git=True -p |
|
1052 | 1052 | changeset: 24:f4f718f27b7c |
|
1053 | 1053 | tag: tip |
|
1054 | 1054 | user: test |
|
1055 | 1055 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
1056 | 1056 | summary: ab |
|
1057 | 1057 | |
|
1058 | 1058 | diff --git a/subdir/f1 b/subdir/f1 |
|
1059 | 1059 | --- a/subdir/f1 |
|
1060 | 1060 | +++ b/subdir/f1 |
|
1061 | 1061 | @@ -2,3 +2,4 @@ |
|
1062 | 1062 | a |
|
1063 | 1063 | a |
|
1064 | 1064 | b |
|
1065 | 1065 | +c |
|
1066 | 1066 | |
|
1067 | 1067 | |
|
1068 | 1068 | #endif |
|
1069 | 1069 | |
|
1070 | 1070 | $ cd .. |
|
1071 | 1071 | |
|
1072 | 1072 | |
|
1073 | 1073 | Abort early when a merge is in progress |
|
1074 | 1074 | |
|
1075 | 1075 | $ hg up 4 |
|
1076 | 1076 | 1 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
1077 | 1077 | |
|
1078 | 1078 | $ touch iwillmergethat |
|
1079 | 1079 | $ hg add iwillmergethat |
|
1080 | 1080 | |
|
1081 | 1081 | $ hg branch thatbranch |
|
1082 | 1082 | marked working directory as branch thatbranch |
|
1083 | 1083 | (branches are permanent and global, did you want a bookmark?) |
|
1084 | 1084 | |
|
1085 | 1085 | $ hg ci -m'new head' |
|
1086 | 1086 | |
|
1087 | 1087 | $ hg up default |
|
1088 | 1088 | 6 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1089 | 1089 | |
|
1090 | 1090 | $ hg merge thatbranch |
|
1091 | 1091 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1092 | 1092 | (branch merge, don't forget to commit) |
|
1093 | 1093 | |
|
1094 | 1094 | $ hg record -m'will abort' |
|
1095 | 1095 | abort: cannot partially commit a merge (use "hg commit" instead) |
|
1096 | 1096 | [255] |
|
1097 | 1097 | |
|
1098 | 1098 | $ hg up -C |
|
1099 | 1099 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1100 | 1100 | |
|
1101 | 1101 | Editing patch (and ignoring trailing text) |
|
1102 | 1102 | |
|
1103 | 1103 | $ cat > editor.sh << '__EOF__' |
|
1104 | 1104 | > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\ |
|
1105 | 1105 | > trailing\nditto' "$1" > tmp |
|
1106 | 1106 | > mv tmp "$1" |
|
1107 | 1107 | > __EOF__ |
|
1108 | 1108 | $ cat > editedfile << '__EOF__' |
|
1109 | 1109 | > This is the first line |
|
1110 | 1110 | > This is the second line |
|
1111 | 1111 | > This is the third line |
|
1112 | 1112 | > __EOF__ |
|
1113 | 1113 | $ hg add editedfile |
|
1114 | 1114 | $ hg commit -medit-patch-1 |
|
1115 | 1115 | $ cat > editedfile << '__EOF__' |
|
1116 | 1116 | > This line has changed |
|
1117 | 1117 | > This change will be committed |
|
1118 | 1118 | > This is the third line |
|
1119 | 1119 | > __EOF__ |
|
1120 | 1120 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-2 <<EOF |
|
1121 | 1121 | > y |
|
1122 | 1122 | > e |
|
1123 | 1123 | > EOF |
|
1124 | 1124 | diff --git a/editedfile b/editedfile |
|
1125 | 1125 | 1 hunks, 2 lines changed |
|
1126 | 1126 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1127 | 1127 | |
|
1128 | 1128 | @@ -1,3 +1,3 @@ |
|
1129 | 1129 | -This is the first line |
|
1130 | 1130 | -This is the second line |
|
1131 | 1131 | +This line has changed |
|
1132 | 1132 | +This change will be committed |
|
1133 | 1133 | This is the third line |
|
1134 | 1134 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1135 | 1135 | |
|
1136 | 1136 | $ cat editedfile |
|
1137 | 1137 | This line has changed |
|
1138 | 1138 | This change will be committed |
|
1139 | 1139 | This is the third line |
|
1140 | 1140 | $ hg cat -r tip editedfile |
|
1141 | 1141 | This is the first line |
|
1142 | 1142 | This change will be committed |
|
1143 | 1143 | This is the third line |
|
1144 | 1144 | $ hg revert editedfile |
|
1145 | 1145 | |
|
1146 | 1146 | Trying to edit patch for whole file |
|
1147 | 1147 | |
|
1148 | 1148 | $ echo "This is the fourth line" >> editedfile |
|
1149 | 1149 | $ hg record <<EOF |
|
1150 | 1150 | > e |
|
1151 | 1151 | > q |
|
1152 | 1152 | > EOF |
|
1153 | 1153 | diff --git a/editedfile b/editedfile |
|
1154 | 1154 | 1 hunks, 1 lines changed |
|
1155 | 1155 | examine changes to 'editedfile'? [Ynesfdaq?] e |
|
1156 | 1156 | |
|
1157 | 1157 | cannot edit patch for whole file |
|
1158 | 1158 | examine changes to 'editedfile'? [Ynesfdaq?] q |
|
1159 | 1159 | |
|
1160 | 1160 | abort: user quit |
|
1161 | 1161 | [255] |
|
1162 | 1162 | $ hg revert editedfile |
|
1163 | 1163 | |
|
1164 | 1164 | Removing changes from patch |
|
1165 | 1165 | |
|
1166 | 1166 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp |
|
1167 | 1167 | $ mv tmp editedfile |
|
1168 | 1168 | $ echo "This line has been added" >> editedfile |
|
1169 | 1169 | $ cat > editor.sh << '__EOF__' |
|
1170 | 1170 | > sed -e 's/^[-+]/ /' "$1" > tmp |
|
1171 | 1171 | > mv tmp "$1" |
|
1172 | 1172 | > __EOF__ |
|
1173 | 1173 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF |
|
1174 | 1174 | > y |
|
1175 | 1175 | > e |
|
1176 | 1176 | > EOF |
|
1177 | 1177 | diff --git a/editedfile b/editedfile |
|
1178 | 1178 | 1 hunks, 3 lines changed |
|
1179 | 1179 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1180 | 1180 | |
|
1181 | 1181 | @@ -1,3 +1,3 @@ |
|
1182 | 1182 | -This is the first line |
|
1183 | 1183 | -This change will be committed |
|
1184 | 1184 | -This is the third line |
|
1185 | 1185 | +This change will not be committed |
|
1186 | 1186 | +This is the second line |
|
1187 | 1187 | +This line has been added |
|
1188 | 1188 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1189 | 1189 | |
|
1190 | 1190 | no changes to record |
|
1191 | 1191 | $ cat editedfile |
|
1192 | 1192 | This change will not be committed |
|
1193 | 1193 | This is the second line |
|
1194 | 1194 | This line has been added |
|
1195 | 1195 | $ hg cat -r tip editedfile |
|
1196 | 1196 | This is the first line |
|
1197 | 1197 | This change will be committed |
|
1198 | 1198 | This is the third line |
|
1199 | 1199 | $ hg revert editedfile |
|
1200 | 1200 | |
|
1201 | 1201 | Invalid patch |
|
1202 | 1202 | |
|
1203 | 1203 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp |
|
1204 | 1204 | $ mv tmp editedfile |
|
1205 | 1205 | $ echo "This line has been added" >> editedfile |
|
1206 | 1206 | $ cat > editor.sh << '__EOF__' |
|
1207 | 1207 | > sed s/This/That/ "$1" > tmp |
|
1208 | 1208 | > mv tmp "$1" |
|
1209 | 1209 | > __EOF__ |
|
1210 | 1210 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF |
|
1211 | 1211 | > y |
|
1212 | 1212 | > e |
|
1213 | 1213 | > EOF |
|
1214 | 1214 | diff --git a/editedfile b/editedfile |
|
1215 | 1215 | 1 hunks, 3 lines changed |
|
1216 | 1216 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1217 | 1217 | |
|
1218 | 1218 | @@ -1,3 +1,3 @@ |
|
1219 | 1219 | -This is the first line |
|
1220 | 1220 | -This change will be committed |
|
1221 | 1221 | -This is the third line |
|
1222 | 1222 | +This change will not be committed |
|
1223 | 1223 | +This is the second line |
|
1224 | 1224 | +This line has been added |
|
1225 | 1225 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1226 | 1226 | |
|
1227 | 1227 | patching file editedfile |
|
1228 | 1228 | Hunk #1 FAILED at 0 |
|
1229 | 1229 | 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej |
|
1230 | 1230 | abort: patch failed to apply |
|
1231 | 1231 | [255] |
|
1232 | 1232 | $ cat editedfile |
|
1233 | 1233 | This change will not be committed |
|
1234 | 1234 | This is the second line |
|
1235 | 1235 | This line has been added |
|
1236 | 1236 | $ hg cat -r tip editedfile |
|
1237 | 1237 | This is the first line |
|
1238 | 1238 | This change will be committed |
|
1239 | 1239 | This is the third line |
|
1240 | 1240 | $ cat editedfile.rej |
|
1241 | 1241 | --- editedfile |
|
1242 | 1242 | +++ editedfile |
|
1243 | 1243 | @@ -1,3 +1,3 @@ |
|
1244 | 1244 | -That is the first line |
|
1245 | 1245 | -That change will be committed |
|
1246 | 1246 | -That is the third line |
|
1247 | 1247 | +That change will not be committed |
|
1248 | 1248 | +That is the second line |
|
1249 | 1249 | +That line has been added |
|
1250 | 1250 | |
|
1251 | 1251 | Malformed patch - error handling |
|
1252 | 1252 | |
|
1253 | 1253 | $ cat > editor.sh << '__EOF__' |
|
1254 | 1254 | > sed -e '/^@/p' "$1" > tmp |
|
1255 | 1255 | > mv tmp "$1" |
|
1256 | 1256 | > __EOF__ |
|
1257 | 1257 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF |
|
1258 | 1258 | > y |
|
1259 | 1259 | > e |
|
1260 | 1260 | > EOF |
|
1261 | 1261 | diff --git a/editedfile b/editedfile |
|
1262 | 1262 | 1 hunks, 3 lines changed |
|
1263 | 1263 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1264 | 1264 | |
|
1265 | 1265 | @@ -1,3 +1,3 @@ |
|
1266 | 1266 | -This is the first line |
|
1267 | 1267 | -This change will be committed |
|
1268 | 1268 | -This is the third line |
|
1269 | 1269 | +This change will not be committed |
|
1270 | 1270 | +This is the second line |
|
1271 | 1271 | +This line has been added |
|
1272 | 1272 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1273 | 1273 | |
|
1274 | 1274 | abort: error parsing patch: unhandled transition: range -> range |
|
1275 | 1275 | [255] |
|
1276 | 1276 | |
|
1277 | 1277 | random text in random positions is still an error |
|
1278 | 1278 | |
|
1279 | 1279 | $ cat > editor.sh << '__EOF__' |
|
1280 | 1280 | > sed -e '/^@/i\ |
|
1281 | 1281 | > other' "$1" > tmp |
|
1282 | 1282 | > mv tmp "$1" |
|
1283 | 1283 | > __EOF__ |
|
1284 | 1284 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF |
|
1285 | 1285 | > y |
|
1286 | 1286 | > e |
|
1287 | 1287 | > EOF |
|
1288 | 1288 | diff --git a/editedfile b/editedfile |
|
1289 | 1289 | 1 hunks, 3 lines changed |
|
1290 | 1290 | examine changes to 'editedfile'? [Ynesfdaq?] y |
|
1291 | 1291 | |
|
1292 | 1292 | @@ -1,3 +1,3 @@ |
|
1293 | 1293 | -This is the first line |
|
1294 | 1294 | -This change will be committed |
|
1295 | 1295 | -This is the third line |
|
1296 | 1296 | +This change will not be committed |
|
1297 | 1297 | +This is the second line |
|
1298 | 1298 | +This line has been added |
|
1299 | 1299 | record this change to 'editedfile'? [Ynesfdaq?] e |
|
1300 | 1300 | |
|
1301 | 1301 | abort: error parsing patch: unhandled transition: file -> other |
|
1302 | 1302 | [255] |
|
1303 | 1303 | |
|
1304 | 1304 | $ hg up -C |
|
1305 | 1305 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1306 | 1306 | |
|
1307 | 1307 | With win32text |
|
1308 | 1308 | |
|
1309 | 1309 | $ echo '[extensions]' >> .hg/hgrc |
|
1310 | 1310 | $ echo 'win32text = ' >> .hg/hgrc |
|
1311 | 1311 | $ echo '[decode]' >> .hg/hgrc |
|
1312 | 1312 | $ echo '** = cleverdecode:' >> .hg/hgrc |
|
1313 | 1313 | $ echo '[encode]' >> .hg/hgrc |
|
1314 | 1314 | $ echo '** = cleverencode:' >> .hg/hgrc |
|
1315 | 1315 | $ echo '[patch]' >> .hg/hgrc |
|
1316 | 1316 | $ echo 'eol = crlf' >> .hg/hgrc |
|
1317 | 1317 | |
|
1318 | 1318 | Ignore win32text deprecation warning for now: |
|
1319 | 1319 | |
|
1320 | 1320 | $ echo '[win32text]' >> .hg/hgrc |
|
1321 | 1321 | $ echo 'warn = no' >> .hg/hgrc |
|
1322 | 1322 | |
|
1323 | 1323 | $ echo d >> subdir/f1 |
|
1324 | 1324 | $ hg record -d '24 0' -mw1 <<EOF |
|
1325 | 1325 | > y |
|
1326 | 1326 | > y |
|
1327 | 1327 | > EOF |
|
1328 | 1328 | diff --git a/subdir/f1 b/subdir/f1 |
|
1329 | 1329 | 1 hunks, 1 lines changed |
|
1330 | 1330 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1331 | 1331 | |
|
1332 | 1332 | @@ -3,3 +3,4 @@ |
|
1333 | 1333 | a |
|
1334 | 1334 | b |
|
1335 | 1335 | c |
|
1336 | 1336 | +d |
|
1337 | 1337 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1338 | 1338 | |
|
1339 | 1339 | |
|
1340 | 1340 | $ hg tip -p |
|
1341 | 1341 | changeset: 28:* (glob) |
|
1342 | 1342 | tag: tip |
|
1343 | 1343 | user: test |
|
1344 | 1344 | date: Thu Jan 01 00:00:24 1970 +0000 |
|
1345 | 1345 | summary: w1 |
|
1346 | 1346 | |
|
1347 | 1347 | diff -r ???????????? -r ???????????? subdir/f1 (glob) |
|
1348 | 1348 | --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 |
|
1349 | 1349 | +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 |
|
1350 | 1350 | @@ -3,3 +3,4 @@ |
|
1351 | 1351 | a |
|
1352 | 1352 | b |
|
1353 | 1353 | c |
|
1354 | 1354 | +d |
|
1355 | 1355 | |
|
1356 | 1356 | Test --user when ui.username not set |
|
1357 | 1357 | $ unset HGUSER |
|
1358 | 1358 | $ echo e >> subdir/f1 |
|
1359 | 1359 | $ hg record --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF |
|
1360 | 1360 | > y |
|
1361 | 1361 | > y |
|
1362 | 1362 | > EOF |
|
1363 | 1363 | diff --git a/subdir/f1 b/subdir/f1 |
|
1364 | 1364 | 1 hunks, 1 lines changed |
|
1365 | 1365 | examine changes to 'subdir/f1'? [Ynesfdaq?] y |
|
1366 | 1366 | |
|
1367 | 1367 | @@ -4,3 +4,4 @@ |
|
1368 | 1368 | b |
|
1369 | 1369 | c |
|
1370 | 1370 | d |
|
1371 | 1371 | +e |
|
1372 | 1372 | record this change to 'subdir/f1'? [Ynesfdaq?] y |
|
1373 | 1373 | |
|
1374 | 1374 | $ hg log --template '{author}\n' -l 1 |
|
1375 | 1375 | xyz |
|
1376 | 1376 | $ HGUSER="test" |
|
1377 | 1377 | $ export HGUSER |
|
1378 | 1378 | |
|
1379 | 1379 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now