##// END OF EJS Templates
record: allow splitting of hunks by manually editing patches...
A. S. Budden -
r16324:46b991a1 default
parent child Browse files
Show More
@@ -1,601 +1,663 b''
1 # record.py
1 # record.py
2 #
2 #
3 # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com>
3 # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''commands to interactively select changes for commit/qrefresh'''
8 '''commands to interactively select changes for commit/qrefresh'''
9
9
10 from mercurial.i18n import gettext, _
10 from mercurial.i18n import gettext, _
11 from mercurial import cmdutil, commands, extensions, hg, mdiff, patch
11 from mercurial import cmdutil, commands, extensions, hg, mdiff, patch
12 from mercurial import util
12 from mercurial import util
13 import copy, cStringIO, errno, os, re, shutil, tempfile
13 import copy, cStringIO, errno, os, re, shutil, tempfile
14
14
15 cmdtable = {}
15 cmdtable = {}
16 command = cmdutil.command(cmdtable)
16 command = cmdutil.command(cmdtable)
17
17
18 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
18 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
19
19
20 diffopts = [
20 diffopts = [
21 ('w', 'ignore-all-space', False,
21 ('w', 'ignore-all-space', False,
22 _('ignore white space when comparing lines')),
22 _('ignore white space when comparing lines')),
23 ('b', 'ignore-space-change', None,
23 ('b', 'ignore-space-change', None,
24 _('ignore changes in the amount of white space')),
24 _('ignore changes in the amount of white space')),
25 ('B', 'ignore-blank-lines', None,
25 ('B', 'ignore-blank-lines', None,
26 _('ignore changes whose lines are all blank')),
26 _('ignore changes whose lines are all blank')),
27 ]
27 ]
28
28
29 def scanpatch(fp):
29 def scanpatch(fp):
30 """like patch.iterhunks, but yield different events
30 """like patch.iterhunks, but yield different events
31
31
32 - ('file', [header_lines + fromfile + tofile])
32 - ('file', [header_lines + fromfile + tofile])
33 - ('context', [context_lines])
33 - ('context', [context_lines])
34 - ('hunk', [hunk_lines])
34 - ('hunk', [hunk_lines])
35 - ('range', (-start,len, +start,len, diffp))
35 - ('range', (-start,len, +start,len, diffp))
36 """
36 """
37 lr = patch.linereader(fp)
37 lr = patch.linereader(fp)
38
38
39 def scanwhile(first, p):
39 def scanwhile(first, p):
40 """scan lr while predicate holds"""
40 """scan lr while predicate holds"""
41 lines = [first]
41 lines = [first]
42 while True:
42 while True:
43 line = lr.readline()
43 line = lr.readline()
44 if not line:
44 if not line:
45 break
45 break
46 if p(line):
46 if p(line):
47 lines.append(line)
47 lines.append(line)
48 else:
48 else:
49 lr.push(line)
49 lr.push(line)
50 break
50 break
51 return lines
51 return lines
52
52
53 while True:
53 while True:
54 line = lr.readline()
54 line = lr.readline()
55 if not line:
55 if not line:
56 break
56 break
57 if line.startswith('diff --git a/') or line.startswith('diff -r '):
57 if line.startswith('diff --git a/') or line.startswith('diff -r '):
58 def notheader(line):
58 def notheader(line):
59 s = line.split(None, 1)
59 s = line.split(None, 1)
60 return not s or s[0] not in ('---', 'diff')
60 return not s or s[0] not in ('---', 'diff')
61 header = scanwhile(line, notheader)
61 header = scanwhile(line, notheader)
62 fromfile = lr.readline()
62 fromfile = lr.readline()
63 if fromfile.startswith('---'):
63 if fromfile.startswith('---'):
64 tofile = lr.readline()
64 tofile = lr.readline()
65 header += [fromfile, tofile]
65 header += [fromfile, tofile]
66 else:
66 else:
67 lr.push(fromfile)
67 lr.push(fromfile)
68 yield 'file', header
68 yield 'file', header
69 elif line[0] == ' ':
69 elif line[0] == ' ':
70 yield 'context', scanwhile(line, lambda l: l[0] in ' \\')
70 yield 'context', scanwhile(line, lambda l: l[0] in ' \\')
71 elif line[0] in '-+':
71 elif line[0] in '-+':
72 yield 'hunk', scanwhile(line, lambda l: l[0] in '-+\\')
72 yield 'hunk', scanwhile(line, lambda l: l[0] in '-+\\')
73 else:
73 else:
74 m = lines_re.match(line)
74 m = lines_re.match(line)
75 if m:
75 if m:
76 yield 'range', m.groups()
76 yield 'range', m.groups()
77 else:
77 else:
78 raise patch.PatchError('unknown patch content: %r' % line)
78 raise patch.PatchError('unknown patch content: %r' % line)
79
79
80 class header(object):
80 class header(object):
81 """patch header
81 """patch header
82
82
83 XXX shoudn't we move this to mercurial/patch.py ?
83 XXX shoudn't we move this to mercurial/patch.py ?
84 """
84 """
85 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
85 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
86 diff_re = re.compile('diff -r .* (.*)$')
86 diff_re = re.compile('diff -r .* (.*)$')
87 allhunks_re = re.compile('(?:index|new file|deleted file) ')
87 allhunks_re = re.compile('(?:index|new file|deleted file) ')
88 pretty_re = re.compile('(?:new file|deleted file) ')
88 pretty_re = re.compile('(?:new file|deleted file) ')
89 special_re = re.compile('(?:index|new|deleted|copy|rename) ')
89 special_re = re.compile('(?:index|new|deleted|copy|rename) ')
90
90
91 def __init__(self, header):
91 def __init__(self, header):
92 self.header = header
92 self.header = header
93 self.hunks = []
93 self.hunks = []
94
94
95 def binary(self):
95 def binary(self):
96 return util.any(h.startswith('index ') for h in self.header)
96 return util.any(h.startswith('index ') for h in self.header)
97
97
98 def pretty(self, fp):
98 def pretty(self, fp):
99 for h in self.header:
99 for h in self.header:
100 if h.startswith('index '):
100 if h.startswith('index '):
101 fp.write(_('this modifies a binary file (all or nothing)\n'))
101 fp.write(_('this modifies a binary file (all or nothing)\n'))
102 break
102 break
103 if self.pretty_re.match(h):
103 if self.pretty_re.match(h):
104 fp.write(h)
104 fp.write(h)
105 if self.binary():
105 if self.binary():
106 fp.write(_('this is a binary file\n'))
106 fp.write(_('this is a binary file\n'))
107 break
107 break
108 if h.startswith('---'):
108 if h.startswith('---'):
109 fp.write(_('%d hunks, %d lines changed\n') %
109 fp.write(_('%d hunks, %d lines changed\n') %
110 (len(self.hunks),
110 (len(self.hunks),
111 sum([max(h.added, h.removed) for h in self.hunks])))
111 sum([max(h.added, h.removed) for h in self.hunks])))
112 break
112 break
113 fp.write(h)
113 fp.write(h)
114
114
115 def write(self, fp):
115 def write(self, fp):
116 fp.write(''.join(self.header))
116 fp.write(''.join(self.header))
117
117
118 def allhunks(self):
118 def allhunks(self):
119 return util.any(self.allhunks_re.match(h) for h in self.header)
119 return util.any(self.allhunks_re.match(h) for h in self.header)
120
120
121 def files(self):
121 def files(self):
122 match = self.diffgit_re.match(self.header[0])
122 match = self.diffgit_re.match(self.header[0])
123 if match:
123 if match:
124 fromfile, tofile = match.groups()
124 fromfile, tofile = match.groups()
125 if fromfile == tofile:
125 if fromfile == tofile:
126 return [fromfile]
126 return [fromfile]
127 return [fromfile, tofile]
127 return [fromfile, tofile]
128 else:
128 else:
129 return self.diff_re.match(self.header[0]).groups()
129 return self.diff_re.match(self.header[0]).groups()
130
130
131 def filename(self):
131 def filename(self):
132 return self.files()[-1]
132 return self.files()[-1]
133
133
134 def __repr__(self):
134 def __repr__(self):
135 return '<header %s>' % (' '.join(map(repr, self.files())))
135 return '<header %s>' % (' '.join(map(repr, self.files())))
136
136
137 def special(self):
137 def special(self):
138 return util.any(self.special_re.match(h) for h in self.header)
138 return util.any(self.special_re.match(h) for h in self.header)
139
139
140 def countchanges(hunk):
140 def countchanges(hunk):
141 """hunk -> (n+,n-)"""
141 """hunk -> (n+,n-)"""
142 add = len([h for h in hunk if h[0] == '+'])
142 add = len([h for h in hunk if h[0] == '+'])
143 rem = len([h for h in hunk if h[0] == '-'])
143 rem = len([h for h in hunk if h[0] == '-'])
144 return add, rem
144 return add, rem
145
145
146 class hunk(object):
146 class hunk(object):
147 """patch hunk
147 """patch hunk
148
148
149 XXX shouldn't we merge this with patch.hunk ?
149 XXX shouldn't we merge this with patch.hunk ?
150 """
150 """
151 maxcontext = 3
151 maxcontext = 3
152
152
153 def __init__(self, header, fromline, toline, proc, before, hunk, after):
153 def __init__(self, header, fromline, toline, proc, before, hunk, after):
154 def trimcontext(number, lines):
154 def trimcontext(number, lines):
155 delta = len(lines) - self.maxcontext
155 delta = len(lines) - self.maxcontext
156 if False and delta > 0:
156 if False and delta > 0:
157 return number + delta, lines[:self.maxcontext]
157 return number + delta, lines[:self.maxcontext]
158 return number, lines
158 return number, lines
159
159
160 self.header = header
160 self.header = header
161 self.fromline, self.before = trimcontext(fromline, before)
161 self.fromline, self.before = trimcontext(fromline, before)
162 self.toline, self.after = trimcontext(toline, after)
162 self.toline, self.after = trimcontext(toline, after)
163 self.proc = proc
163 self.proc = proc
164 self.hunk = hunk
164 self.hunk = hunk
165 self.added, self.removed = countchanges(self.hunk)
165 self.added, self.removed = countchanges(self.hunk)
166
166
167 def write(self, fp):
167 def write(self, fp):
168 delta = len(self.before) + len(self.after)
168 delta = len(self.before) + len(self.after)
169 if self.after and self.after[-1] == '\\ No newline at end of file\n':
169 if self.after and self.after[-1] == '\\ No newline at end of file\n':
170 delta -= 1
170 delta -= 1
171 fromlen = delta + self.removed
171 fromlen = delta + self.removed
172 tolen = delta + self.added
172 tolen = delta + self.added
173 fp.write('@@ -%d,%d +%d,%d @@%s\n' %
173 fp.write('@@ -%d,%d +%d,%d @@%s\n' %
174 (self.fromline, fromlen, self.toline, tolen,
174 (self.fromline, fromlen, self.toline, tolen,
175 self.proc and (' ' + self.proc)))
175 self.proc and (' ' + self.proc)))
176 fp.write(''.join(self.before + self.hunk + self.after))
176 fp.write(''.join(self.before + self.hunk + self.after))
177
177
178 pretty = write
178 pretty = write
179
179
180 def filename(self):
180 def filename(self):
181 return self.header.filename()
181 return self.header.filename()
182
182
183 def __repr__(self):
183 def __repr__(self):
184 return '<hunk %r@%d>' % (self.filename(), self.fromline)
184 return '<hunk %r@%d>' % (self.filename(), self.fromline)
185
185
186 def parsepatch(fp):
186 def parsepatch(fp):
187 """patch -> [] of headers -> [] of hunks """
187 """patch -> [] of headers -> [] of hunks """
188 class parser(object):
188 class parser(object):
189 """patch parsing state machine"""
189 """patch parsing state machine"""
190 def __init__(self):
190 def __init__(self):
191 self.fromline = 0
191 self.fromline = 0
192 self.toline = 0
192 self.toline = 0
193 self.proc = ''
193 self.proc = ''
194 self.header = None
194 self.header = None
195 self.context = []
195 self.context = []
196 self.before = []
196 self.before = []
197 self.hunk = []
197 self.hunk = []
198 self.headers = []
198 self.headers = []
199
199
200 def addrange(self, limits):
200 def addrange(self, limits):
201 fromstart, fromend, tostart, toend, proc = limits
201 fromstart, fromend, tostart, toend, proc = limits
202 self.fromline = int(fromstart)
202 self.fromline = int(fromstart)
203 self.toline = int(tostart)
203 self.toline = int(tostart)
204 self.proc = proc
204 self.proc = proc
205
205
206 def addcontext(self, context):
206 def addcontext(self, context):
207 if self.hunk:
207 if self.hunk:
208 h = hunk(self.header, self.fromline, self.toline, self.proc,
208 h = hunk(self.header, self.fromline, self.toline, self.proc,
209 self.before, self.hunk, context)
209 self.before, self.hunk, context)
210 self.header.hunks.append(h)
210 self.header.hunks.append(h)
211 self.fromline += len(self.before) + h.removed
211 self.fromline += len(self.before) + h.removed
212 self.toline += len(self.before) + h.added
212 self.toline += len(self.before) + h.added
213 self.before = []
213 self.before = []
214 self.hunk = []
214 self.hunk = []
215 self.proc = ''
215 self.proc = ''
216 self.context = context
216 self.context = context
217
217
218 def addhunk(self, hunk):
218 def addhunk(self, hunk):
219 if self.context:
219 if self.context:
220 self.before = self.context
220 self.before = self.context
221 self.context = []
221 self.context = []
222 self.hunk = hunk
222 self.hunk = hunk
223
223
224 def newfile(self, hdr):
224 def newfile(self, hdr):
225 self.addcontext([])
225 self.addcontext([])
226 h = header(hdr)
226 h = header(hdr)
227 self.headers.append(h)
227 self.headers.append(h)
228 self.header = h
228 self.header = h
229
229
230 def finished(self):
230 def finished(self):
231 self.addcontext([])
231 self.addcontext([])
232 return self.headers
232 return self.headers
233
233
234 transitions = {
234 transitions = {
235 'file': {'context': addcontext,
235 'file': {'context': addcontext,
236 'file': newfile,
236 'file': newfile,
237 'hunk': addhunk,
237 'hunk': addhunk,
238 'range': addrange},
238 'range': addrange},
239 'context': {'file': newfile,
239 'context': {'file': newfile,
240 'hunk': addhunk,
240 'hunk': addhunk,
241 'range': addrange},
241 'range': addrange},
242 'hunk': {'context': addcontext,
242 'hunk': {'context': addcontext,
243 'file': newfile,
243 'file': newfile,
244 'range': addrange},
244 'range': addrange},
245 'range': {'context': addcontext,
245 'range': {'context': addcontext,
246 'hunk': addhunk},
246 'hunk': addhunk},
247 }
247 }
248
248
249 p = parser()
249 p = parser()
250
250
251 state = 'context'
251 state = 'context'
252 for newstate, data in scanpatch(fp):
252 for newstate, data in scanpatch(fp):
253 try:
253 try:
254 p.transitions[state][newstate](p, data)
254 p.transitions[state][newstate](p, data)
255 except KeyError:
255 except KeyError:
256 raise patch.PatchError('unhandled transition: %s -> %s' %
256 raise patch.PatchError('unhandled transition: %s -> %s' %
257 (state, newstate))
257 (state, newstate))
258 state = newstate
258 state = newstate
259 return p.finished()
259 return p.finished()
260
260
261 def filterpatch(ui, headers):
261 def filterpatch(ui, headers):
262 """Interactively filter patch chunks into applied-only chunks"""
262 """Interactively filter patch chunks into applied-only chunks"""
263
263
264 def prompt(skipfile, skipall, query):
264 def prompt(skipfile, skipall, query, chunk):
265 """prompt query, and process base inputs
265 """prompt query, and process base inputs
266
266
267 - y/n for the rest of file
267 - y/n for the rest of file
268 - y/n for the rest
268 - y/n for the rest
269 - ? (help)
269 - ? (help)
270 - q (quit)
270 - q (quit)
271
271
272 Return True/False and possibly updated skipfile and skipall.
272 Return True/False and possibly updated skipfile and skipall.
273 """
273 """
274 newpatches = None
274 if skipall is not None:
275 if skipall is not None:
275 return skipall, skipfile, skipall
276 return skipall, skipfile, skipall, newpatches
276 if skipfile is not None:
277 if skipfile is not None:
277 return skipfile, skipfile, skipall
278 return skipfile, skipfile, skipall, newpatches
278 while True:
279 while True:
279 resps = _('[Ynsfdaq?]')
280 resps = _('[Ynesfdaq?]')
280 choices = (_('&Yes, record this change'),
281 choices = (_('&Yes, record this change'),
281 _('&No, skip this change'),
282 _('&No, skip this change'),
283 _('&Edit the change manually'),
282 _('&Skip remaining changes to this file'),
284 _('&Skip remaining changes to this file'),
283 _('Record remaining changes to this &file'),
285 _('Record remaining changes to this &file'),
284 _('&Done, skip remaining changes and files'),
286 _('&Done, skip remaining changes and files'),
285 _('Record &all changes to all remaining files'),
287 _('Record &all changes to all remaining files'),
286 _('&Quit, recording no changes'),
288 _('&Quit, recording no changes'),
287 _('&?'))
289 _('&?'))
288 r = ui.promptchoice("%s %s" % (query, resps), choices)
290 r = ui.promptchoice("%s %s" % (query, resps), choices)
289 ui.write("\n")
291 ui.write("\n")
290 if r == 7: # ?
292 if r == 8: # ?
291 doc = gettext(record.__doc__)
293 doc = gettext(record.__doc__)
292 c = doc.find('::') + 2
294 c = doc.find('::') + 2
293 for l in doc[c:].splitlines():
295 for l in doc[c:].splitlines():
294 if l.startswith(' '):
296 if l.startswith(' '):
295 ui.write(l.strip(), '\n')
297 ui.write(l.strip(), '\n')
296 continue
298 continue
297 elif r == 0: # yes
299 elif r == 0: # yes
298 ret = True
300 ret = True
299 elif r == 1: # no
301 elif r == 1: # no
300 ret = False
302 ret = False
301 elif r == 2: # Skip
303 elif r == 2: # Edit patch
304 if chunk is None:
305 ui.write(_('cannot edit patch for whole file'))
306 ui.write("\n")
307 continue
308 if chunk.header.binary():
309 ui.write(_('cannot edit patch for binary file'))
310 ui.write("\n")
311 continue
312 # Patch comment based on the Git one (based on comment at end of
313 # http://mercurial.selenic.com/wiki/RecordExtension)
314 phelp = '---' + _("""
315 To remove '-' lines, make them ' ' lines (context).
316 To remove '+' lines, delete them.
317 Lines starting with # will be removed from the patch.
318
319 If the patch applies cleanly, the edited hunk will immediately be
320 added to the record list. If it does not apply cleanly, a rejects
321 file will be generated: you can use that when you try again. If
322 all lines of the hunk are removed, then the edit is aborted and
323 the hunk is left unchanged.
324 """)
325 (patchfd, patchfn) = tempfile.mkstemp(prefix="hg-editor-",
326 suffix=".diff", text=True)
327 try:
328 # Write the initial patch
329 f = os.fdopen(patchfd, "w")
330 chunk.header.write(f)
331 chunk.write(f)
332 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
333 f.close()
334 # Start the editor and wait for it to complete
335 editor = ui.geteditor()
336 util.system("%s \"%s\"" % (editor, patchfn),
337 environ={'HGUSER': ui.username()},
338 onerr=util.Abort, errprefix=_("edit failed"),
339 out=ui.fout)
340 # Remove comment lines
341 patchfp = open(patchfn)
342 ncpatchfp = cStringIO.StringIO()
343 for line in patchfp:
344 if not line.startswith('#'):
345 ncpatchfp.write(line)
346 patchfp.close()
347 ncpatchfp.seek(0)
348 newpatches = parsepatch(ncpatchfp)
349 finally:
350 os.unlink(patchfn)
351 del ncpatchfp
352 # Signal that the chunk shouldn't be applied as-is, but
353 # provide the new patch to be used instead.
354 ret = False
355 elif r == 3: # Skip
302 ret = skipfile = False
356 ret = skipfile = False
303 elif r == 3: # file (Record remaining)
357 elif r == 4: # file (Record remaining)
304 ret = skipfile = True
358 ret = skipfile = True
305 elif r == 4: # done, skip remaining
359 elif r == 5: # done, skip remaining
306 ret = skipall = False
360 ret = skipall = False
307 elif r == 5: # all
361 elif r == 6: # all
308 ret = skipall = True
362 ret = skipall = True
309 elif r == 6: # quit
363 elif r == 7: # quit
310 raise util.Abort(_('user quit'))
364 raise util.Abort(_('user quit'))
311 return ret, skipfile, skipall
365 return ret, skipfile, skipall, newpatches
312
366
313 seen = set()
367 seen = set()
314 applied = {} # 'filename' -> [] of chunks
368 applied = {} # 'filename' -> [] of chunks
315 skipfile, skipall = None, None
369 skipfile, skipall = None, None
316 pos, total = 1, sum(len(h.hunks) for h in headers)
370 pos, total = 1, sum(len(h.hunks) for h in headers)
317 for h in headers:
371 for h in headers:
318 pos += len(h.hunks)
372 pos += len(h.hunks)
319 skipfile = None
373 skipfile = None
320 fixoffset = 0
374 fixoffset = 0
321 hdr = ''.join(h.header)
375 hdr = ''.join(h.header)
322 if hdr in seen:
376 if hdr in seen:
323 continue
377 continue
324 seen.add(hdr)
378 seen.add(hdr)
325 if skipall is None:
379 if skipall is None:
326 h.pretty(ui)
380 h.pretty(ui)
327 msg = (_('examine changes to %s?') %
381 msg = (_('examine changes to %s?') %
328 _(' and ').join(map(repr, h.files())))
382 _(' and ').join(map(repr, h.files())))
329 r, skipfile, skipall = prompt(skipfile, skipall, msg)
383 r, skipfile, skipall, np = prompt(skipfile, skipall, msg, None)
330 if not r:
384 if not r:
331 continue
385 continue
332 applied[h.filename()] = [h]
386 applied[h.filename()] = [h]
333 if h.allhunks():
387 if h.allhunks():
334 applied[h.filename()] += h.hunks
388 applied[h.filename()] += h.hunks
335 continue
389 continue
336 for i, chunk in enumerate(h.hunks):
390 for i, chunk in enumerate(h.hunks):
337 if skipfile is None and skipall is None:
391 if skipfile is None and skipall is None:
338 chunk.pretty(ui)
392 chunk.pretty(ui)
339 if total == 1:
393 if total == 1:
340 msg = _('record this change to %r?') % chunk.filename()
394 msg = _('record this change to %r?') % chunk.filename()
341 else:
395 else:
342 idx = pos - len(h.hunks) + i
396 idx = pos - len(h.hunks) + i
343 msg = _('record change %d/%d to %r?') % (idx, total,
397 msg = _('record change %d/%d to %r?') % (idx, total,
344 chunk.filename())
398 chunk.filename())
345 r, skipfile, skipall = prompt(skipfile, skipall, msg)
399 r, skipfile, skipall, newpatches = prompt(skipfile,
400 skipall, msg, chunk)
346 if r:
401 if r:
347 if fixoffset:
402 if fixoffset:
348 chunk = copy.copy(chunk)
403 chunk = copy.copy(chunk)
349 chunk.toline += fixoffset
404 chunk.toline += fixoffset
350 applied[chunk.filename()].append(chunk)
405 applied[chunk.filename()].append(chunk)
406 elif newpatches is not None:
407 for newpatch in newpatches:
408 for newhunk in newpatch.hunks:
409 if fixoffset:
410 newhunk.toline += fixoffset
411 applied[newhunk.filename()].append(newhunk)
351 else:
412 else:
352 fixoffset += chunk.removed - chunk.added
413 fixoffset += chunk.removed - chunk.added
353 return sum([h for h in applied.itervalues()
414 return sum([h for h in applied.itervalues()
354 if h[0].special() or len(h) > 1], [])
415 if h[0].special() or len(h) > 1], [])
355
416
356 @command("record",
417 @command("record",
357 # same options as commit + white space diff options
418 # same options as commit + white space diff options
358 commands.table['^commit|ci'][1][:] + diffopts,
419 commands.table['^commit|ci'][1][:] + diffopts,
359 _('hg record [OPTION]... [FILE]...'))
420 _('hg record [OPTION]... [FILE]...'))
360 def record(ui, repo, *pats, **opts):
421 def record(ui, repo, *pats, **opts):
361 '''interactively select changes to commit
422 '''interactively select changes to commit
362
423
363 If a list of files is omitted, all changes reported by :hg:`status`
424 If a list of files is omitted, all changes reported by :hg:`status`
364 will be candidates for recording.
425 will be candidates for recording.
365
426
366 See :hg:`help dates` for a list of formats valid for -d/--date.
427 See :hg:`help dates` for a list of formats valid for -d/--date.
367
428
368 You will be prompted for whether to record changes to each
429 You will be prompted for whether to record changes to each
369 modified file, and for files with multiple changes, for each
430 modified file, and for files with multiple changes, for each
370 change to use. For each query, the following responses are
431 change to use. For each query, the following responses are
371 possible::
432 possible::
372
433
373 y - record this change
434 y - record this change
374 n - skip this change
435 n - skip this change
436 e - edit this change manually
375
437
376 s - skip remaining changes to this file
438 s - skip remaining changes to this file
377 f - record remaining changes to this file
439 f - record remaining changes to this file
378
440
379 d - done, skip remaining changes and files
441 d - done, skip remaining changes and files
380 a - record all changes to all remaining files
442 a - record all changes to all remaining files
381 q - quit, recording no changes
443 q - quit, recording no changes
382
444
383 ? - display help
445 ? - display help
384
446
385 This command is not available when committing a merge.'''
447 This command is not available when committing a merge.'''
386
448
387 dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
449 dorecord(ui, repo, commands.commit, 'commit', False, *pats, **opts)
388
450
389 def qrefresh(origfn, ui, repo, *pats, **opts):
451 def qrefresh(origfn, ui, repo, *pats, **opts):
390 if not opts['interactive']:
452 if not opts['interactive']:
391 return origfn(ui, repo, *pats, **opts)
453 return origfn(ui, repo, *pats, **opts)
392
454
393 mq = extensions.find('mq')
455 mq = extensions.find('mq')
394
456
395 def committomq(ui, repo, *pats, **opts):
457 def committomq(ui, repo, *pats, **opts):
396 # At this point the working copy contains only changes that
458 # At this point the working copy contains only changes that
397 # were accepted. All other changes were reverted.
459 # were accepted. All other changes were reverted.
398 # We can't pass *pats here since qrefresh will undo all other
460 # We can't pass *pats here since qrefresh will undo all other
399 # changed files in the patch that aren't in pats.
461 # changed files in the patch that aren't in pats.
400 mq.refresh(ui, repo, **opts)
462 mq.refresh(ui, repo, **opts)
401
463
402 # backup all changed files
464 # backup all changed files
403 dorecord(ui, repo, committomq, 'qrefresh', True, *pats, **opts)
465 dorecord(ui, repo, committomq, 'qrefresh', True, *pats, **opts)
404
466
405 def qrecord(ui, repo, patch, *pats, **opts):
467 def qrecord(ui, repo, patch, *pats, **opts):
406 '''interactively record a new patch
468 '''interactively record a new patch
407
469
408 See :hg:`help qnew` & :hg:`help record` for more information and
470 See :hg:`help qnew` & :hg:`help record` for more information and
409 usage.
471 usage.
410 '''
472 '''
411
473
412 try:
474 try:
413 mq = extensions.find('mq')
475 mq = extensions.find('mq')
414 except KeyError:
476 except KeyError:
415 raise util.Abort(_("'mq' extension not loaded"))
477 raise util.Abort(_("'mq' extension not loaded"))
416
478
417 repo.mq.checkpatchname(patch)
479 repo.mq.checkpatchname(patch)
418
480
419 def committomq(ui, repo, *pats, **opts):
481 def committomq(ui, repo, *pats, **opts):
420 opts['checkname'] = False
482 opts['checkname'] = False
421 mq.new(ui, repo, patch, *pats, **opts)
483 mq.new(ui, repo, patch, *pats, **opts)
422
484
423 dorecord(ui, repo, committomq, 'qnew', False, *pats, **opts)
485 dorecord(ui, repo, committomq, 'qnew', False, *pats, **opts)
424
486
425 def qnew(origfn, ui, repo, patch, *args, **opts):
487 def qnew(origfn, ui, repo, patch, *args, **opts):
426 if opts['interactive']:
488 if opts['interactive']:
427 return qrecord(ui, repo, patch, *args, **opts)
489 return qrecord(ui, repo, patch, *args, **opts)
428 return origfn(ui, repo, patch, *args, **opts)
490 return origfn(ui, repo, patch, *args, **opts)
429
491
430 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts):
492 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, *pats, **opts):
431 if not ui.interactive():
493 if not ui.interactive():
432 raise util.Abort(_('running non-interactively, use %s instead') %
494 raise util.Abort(_('running non-interactively, use %s instead') %
433 cmdsuggest)
495 cmdsuggest)
434
496
435 def recordfunc(ui, repo, message, match, opts):
497 def recordfunc(ui, repo, message, match, opts):
436 """This is generic record driver.
498 """This is generic record driver.
437
499
438 Its job is to interactively filter local changes, and
500 Its job is to interactively filter local changes, and
439 accordingly prepare working directory into a state in which the
501 accordingly prepare working directory into a state in which the
440 job can be delegated to a non-interactive commit command such as
502 job can be delegated to a non-interactive commit command such as
441 'commit' or 'qrefresh'.
503 'commit' or 'qrefresh'.
442
504
443 After the actual job is done by non-interactive command, the
505 After the actual job is done by non-interactive command, the
444 working directory is restored to its original state.
506 working directory is restored to its original state.
445
507
446 In the end we'll record interesting changes, and everything else
508 In the end we'll record interesting changes, and everything else
447 will be left in place, so the user can continue working.
509 will be left in place, so the user can continue working.
448 """
510 """
449
511
450 merge = len(repo[None].parents()) > 1
512 merge = len(repo[None].parents()) > 1
451 if merge:
513 if merge:
452 raise util.Abort(_('cannot partially commit a merge '
514 raise util.Abort(_('cannot partially commit a merge '
453 '(use "hg commit" instead)'))
515 '(use "hg commit" instead)'))
454
516
455 changes = repo.status(match=match)[:3]
517 changes = repo.status(match=match)[:3]
456 diffopts = mdiff.diffopts(git=True, nodates=True,
518 diffopts = mdiff.diffopts(git=True, nodates=True,
457 ignorews=opts.get('ignore_all_space'),
519 ignorews=opts.get('ignore_all_space'),
458 ignorewsamount=opts.get('ignore_space_change'),
520 ignorewsamount=opts.get('ignore_space_change'),
459 ignoreblanklines=opts.get('ignore_blank_lines'))
521 ignoreblanklines=opts.get('ignore_blank_lines'))
460 chunks = patch.diff(repo, changes=changes, opts=diffopts)
522 chunks = patch.diff(repo, changes=changes, opts=diffopts)
461 fp = cStringIO.StringIO()
523 fp = cStringIO.StringIO()
462 fp.write(''.join(chunks))
524 fp.write(''.join(chunks))
463 fp.seek(0)
525 fp.seek(0)
464
526
465 # 1. filter patch, so we have intending-to apply subset of it
527 # 1. filter patch, so we have intending-to apply subset of it
466 chunks = filterpatch(ui, parsepatch(fp))
528 chunks = filterpatch(ui, parsepatch(fp))
467 del fp
529 del fp
468
530
469 contenders = set()
531 contenders = set()
470 for h in chunks:
532 for h in chunks:
471 try:
533 try:
472 contenders.update(set(h.files()))
534 contenders.update(set(h.files()))
473 except AttributeError:
535 except AttributeError:
474 pass
536 pass
475
537
476 changed = changes[0] + changes[1] + changes[2]
538 changed = changes[0] + changes[1] + changes[2]
477 newfiles = [f for f in changed if f in contenders]
539 newfiles = [f for f in changed if f in contenders]
478 if not newfiles:
540 if not newfiles:
479 ui.status(_('no changes to record\n'))
541 ui.status(_('no changes to record\n'))
480 return 0
542 return 0
481
543
482 modified = set(changes[0])
544 modified = set(changes[0])
483
545
484 # 2. backup changed files, so we can restore them in the end
546 # 2. backup changed files, so we can restore them in the end
485 if backupall:
547 if backupall:
486 tobackup = changed
548 tobackup = changed
487 else:
549 else:
488 tobackup = [f for f in newfiles if f in modified]
550 tobackup = [f for f in newfiles if f in modified]
489
551
490 backups = {}
552 backups = {}
491 if tobackup:
553 if tobackup:
492 backupdir = repo.join('record-backups')
554 backupdir = repo.join('record-backups')
493 try:
555 try:
494 os.mkdir(backupdir)
556 os.mkdir(backupdir)
495 except OSError, err:
557 except OSError, err:
496 if err.errno != errno.EEXIST:
558 if err.errno != errno.EEXIST:
497 raise
559 raise
498 try:
560 try:
499 # backup continues
561 # backup continues
500 for f in tobackup:
562 for f in tobackup:
501 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
563 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
502 dir=backupdir)
564 dir=backupdir)
503 os.close(fd)
565 os.close(fd)
504 ui.debug('backup %r as %r\n' % (f, tmpname))
566 ui.debug('backup %r as %r\n' % (f, tmpname))
505 util.copyfile(repo.wjoin(f), tmpname)
567 util.copyfile(repo.wjoin(f), tmpname)
506 shutil.copystat(repo.wjoin(f), tmpname)
568 shutil.copystat(repo.wjoin(f), tmpname)
507 backups[f] = tmpname
569 backups[f] = tmpname
508
570
509 fp = cStringIO.StringIO()
571 fp = cStringIO.StringIO()
510 for c in chunks:
572 for c in chunks:
511 if c.filename() in backups:
573 if c.filename() in backups:
512 c.write(fp)
574 c.write(fp)
513 dopatch = fp.tell()
575 dopatch = fp.tell()
514 fp.seek(0)
576 fp.seek(0)
515
577
516 # 3a. apply filtered patch to clean repo (clean)
578 # 3a. apply filtered patch to clean repo (clean)
517 if backups:
579 if backups:
518 hg.revert(repo, repo.dirstate.p1(),
580 hg.revert(repo, repo.dirstate.p1(),
519 lambda key: key in backups)
581 lambda key: key in backups)
520
582
521 # 3b. (apply)
583 # 3b. (apply)
522 if dopatch:
584 if dopatch:
523 try:
585 try:
524 ui.debug('applying patch\n')
586 ui.debug('applying patch\n')
525 ui.debug(fp.getvalue())
587 ui.debug(fp.getvalue())
526 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
588 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
527 except patch.PatchError, err:
589 except patch.PatchError, err:
528 raise util.Abort(str(err))
590 raise util.Abort(str(err))
529 del fp
591 del fp
530
592
531 # 4. We prepared working directory according to filtered
593 # 4. We prepared working directory according to filtered
532 # patch. Now is the time to delegate the job to
594 # patch. Now is the time to delegate the job to
533 # commit/qrefresh or the like!
595 # commit/qrefresh or the like!
534
596
535 # it is important to first chdir to repo root -- we'll call
597 # it is important to first chdir to repo root -- we'll call
536 # a highlevel command with list of pathnames relative to
598 # a highlevel command with list of pathnames relative to
537 # repo root
599 # repo root
538 cwd = os.getcwd()
600 cwd = os.getcwd()
539 os.chdir(repo.root)
601 os.chdir(repo.root)
540 try:
602 try:
541 commitfunc(ui, repo, *newfiles, **opts)
603 commitfunc(ui, repo, *newfiles, **opts)
542 finally:
604 finally:
543 os.chdir(cwd)
605 os.chdir(cwd)
544
606
545 return 0
607 return 0
546 finally:
608 finally:
547 # 5. finally restore backed-up files
609 # 5. finally restore backed-up files
548 try:
610 try:
549 for realname, tmpname in backups.iteritems():
611 for realname, tmpname in backups.iteritems():
550 ui.debug('restoring %r to %r\n' % (tmpname, realname))
612 ui.debug('restoring %r to %r\n' % (tmpname, realname))
551 util.copyfile(tmpname, repo.wjoin(realname))
613 util.copyfile(tmpname, repo.wjoin(realname))
552 # Our calls to copystat() here and above are a
614 # Our calls to copystat() here and above are a
553 # hack to trick any editors that have f open that
615 # hack to trick any editors that have f open that
554 # we haven't modified them.
616 # we haven't modified them.
555 #
617 #
556 # Also note that this racy as an editor could
618 # Also note that this racy as an editor could
557 # notice the file's mtime before we've finished
619 # notice the file's mtime before we've finished
558 # writing it.
620 # writing it.
559 shutil.copystat(tmpname, repo.wjoin(realname))
621 shutil.copystat(tmpname, repo.wjoin(realname))
560 os.unlink(tmpname)
622 os.unlink(tmpname)
561 if tobackup:
623 if tobackup:
562 os.rmdir(backupdir)
624 os.rmdir(backupdir)
563 except OSError:
625 except OSError:
564 pass
626 pass
565
627
566 # wrap ui.write so diff output can be labeled/colorized
628 # wrap ui.write so diff output can be labeled/colorized
567 def wrapwrite(orig, *args, **kw):
629 def wrapwrite(orig, *args, **kw):
568 label = kw.pop('label', '')
630 label = kw.pop('label', '')
569 for chunk, l in patch.difflabel(lambda: args):
631 for chunk, l in patch.difflabel(lambda: args):
570 orig(chunk, label=label + l)
632 orig(chunk, label=label + l)
571 oldwrite = ui.write
633 oldwrite = ui.write
572 extensions.wrapfunction(ui, 'write', wrapwrite)
634 extensions.wrapfunction(ui, 'write', wrapwrite)
573 try:
635 try:
574 return cmdutil.commit(ui, repo, recordfunc, pats, opts)
636 return cmdutil.commit(ui, repo, recordfunc, pats, opts)
575 finally:
637 finally:
576 ui.write = oldwrite
638 ui.write = oldwrite
577
639
578 cmdtable["qrecord"] = \
640 cmdtable["qrecord"] = \
579 (qrecord, [], # placeholder until mq is available
641 (qrecord, [], # placeholder until mq is available
580 _('hg qrecord [OPTION]... PATCH [FILE]...'))
642 _('hg qrecord [OPTION]... PATCH [FILE]...'))
581
643
582 def uisetup(ui):
644 def uisetup(ui):
583 try:
645 try:
584 mq = extensions.find('mq')
646 mq = extensions.find('mq')
585 except KeyError:
647 except KeyError:
586 return
648 return
587
649
588 cmdtable["qrecord"] = \
650 cmdtable["qrecord"] = \
589 (qrecord,
651 (qrecord,
590 # same options as qnew, but copy them so we don't get
652 # same options as qnew, but copy them so we don't get
591 # -i/--interactive for qrecord and add white space diff options
653 # -i/--interactive for qrecord and add white space diff options
592 mq.cmdtable['^qnew'][1][:] + diffopts,
654 mq.cmdtable['^qnew'][1][:] + diffopts,
593 _('hg qrecord [OPTION]... PATCH [FILE]...'))
655 _('hg qrecord [OPTION]... PATCH [FILE]...'))
594
656
595 _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
657 _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
596 _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
658 _wrapcmd('qrefresh', mq.cmdtable, qrefresh,
597 _("interactively select changes to refresh"))
659 _("interactively select changes to refresh"))
598
660
599 def _wrapcmd(cmd, table, wrapfn, msg):
661 def _wrapcmd(cmd, table, wrapfn, msg):
600 entry = extensions.wrapcommand(table, cmd, wrapfn)
662 entry = extensions.wrapcommand(table, cmd, wrapfn)
601 entry[1].append(('i', 'interactive', None, msg))
663 entry[1].append(('i', 'interactive', None, msg))
@@ -1,126 +1,126 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
1 $ "$TESTDIR/hghave" execbit || exit 80
2
2
3 Setup
3 Setup
4
4
5 $ echo "[color]" >> $HGRCPATH
5 $ echo "[color]" >> $HGRCPATH
6 $ echo "mode = ansi" >> $HGRCPATH
6 $ echo "mode = ansi" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "color=" >> $HGRCPATH
8 $ echo "color=" >> $HGRCPATH
9 $ hg init repo
9 $ hg init repo
10 $ cd repo
10 $ cd repo
11 $ cat > a <<EOF
11 $ cat > a <<EOF
12 > c
12 > c
13 > c
13 > c
14 > a
14 > a
15 > a
15 > a
16 > b
16 > b
17 > a
17 > a
18 > a
18 > a
19 > c
19 > c
20 > c
20 > c
21 > EOF
21 > EOF
22 $ hg ci -Am adda
22 $ hg ci -Am adda
23 adding a
23 adding a
24 $ cat > a <<EOF
24 $ cat > a <<EOF
25 > c
25 > c
26 > c
26 > c
27 > a
27 > a
28 > a
28 > a
29 > dd
29 > dd
30 > a
30 > a
31 > a
31 > a
32 > c
32 > c
33 > c
33 > c
34 > EOF
34 > EOF
35
35
36 default context
36 default context
37
37
38 $ hg diff --nodates --color=always
38 $ hg diff --nodates --color=always
39 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
39 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
40 \x1b[0;31;1m--- a/a\x1b[0m (esc)
40 \x1b[0;31;1m--- a/a\x1b[0m (esc)
41 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
41 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
42 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
42 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
43 c
43 c
44 a
44 a
45 a
45 a
46 \x1b[0;31m-b\x1b[0m (esc)
46 \x1b[0;31m-b\x1b[0m (esc)
47 \x1b[0;32m+dd\x1b[0m (esc)
47 \x1b[0;32m+dd\x1b[0m (esc)
48 a
48 a
49 a
49 a
50 c
50 c
51
51
52 --unified=2
52 --unified=2
53
53
54 $ hg diff --nodates -U 2 --color=always
54 $ hg diff --nodates -U 2 --color=always
55 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
55 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
56 \x1b[0;31;1m--- a/a\x1b[0m (esc)
56 \x1b[0;31;1m--- a/a\x1b[0m (esc)
57 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
57 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
58 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
58 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
59 a
59 a
60 a
60 a
61 \x1b[0;31m-b\x1b[0m (esc)
61 \x1b[0;31m-b\x1b[0m (esc)
62 \x1b[0;32m+dd\x1b[0m (esc)
62 \x1b[0;32m+dd\x1b[0m (esc)
63 a
63 a
64 a
64 a
65
65
66 diffstat
66 diffstat
67
67
68 $ hg diff --stat --color=always
68 $ hg diff --stat --color=always
69 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
69 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
70 1 files changed, 1 insertions(+), 1 deletions(-)
70 1 files changed, 1 insertions(+), 1 deletions(-)
71 $ echo "record=" >> $HGRCPATH
71 $ echo "record=" >> $HGRCPATH
72 $ echo "[ui]" >> $HGRCPATH
72 $ echo "[ui]" >> $HGRCPATH
73 $ echo "interactive=true" >> $HGRCPATH
73 $ echo "interactive=true" >> $HGRCPATH
74 $ echo "[diff]" >> $HGRCPATH
74 $ echo "[diff]" >> $HGRCPATH
75 $ echo "git=True" >> $HGRCPATH
75 $ echo "git=True" >> $HGRCPATH
76
76
77 record
77 record
78
78
79 $ chmod +x a
79 $ chmod +x a
80 $ hg record --color=always -m moda a <<EOF
80 $ hg record --color=always -m moda a <<EOF
81 > y
81 > y
82 > y
82 > y
83 > EOF
83 > EOF
84 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
84 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
85 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
85 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
86 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
86 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
87 1 hunks, 1 lines changed
87 1 hunks, 1 lines changed
88 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
88 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m (esc)
89 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
89 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
90 c
90 c
91 a
91 a
92 a
92 a
93 \x1b[0;31m-b\x1b[0m (esc)
93 \x1b[0;31m-b\x1b[0m (esc)
94 \x1b[0;32m+dd\x1b[0m (esc)
94 \x1b[0;32m+dd\x1b[0m (esc)
95 a
95 a
96 a
96 a
97 c
97 c
98 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
98 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m (esc)
99
99
100 $ echo "[extensions]" >> $HGRCPATH
100 $ echo "[extensions]" >> $HGRCPATH
101 $ echo "mq=" >> $HGRCPATH
101 $ echo "mq=" >> $HGRCPATH
102 $ hg rollback
102 $ hg rollback
103 repository tip rolled back to revision 0 (undo commit)
103 repository tip rolled back to revision 0 (undo commit)
104 working directory now based on revision 0
104 working directory now based on revision 0
105
105
106 qrecord
106 qrecord
107
107
108 $ hg qrecord --color=always -m moda patch <<EOF
108 $ hg qrecord --color=always -m moda patch <<EOF
109 > y
109 > y
110 > y
110 > y
111 > EOF
111 > EOF
112 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
112 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
113 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
113 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
114 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
114 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
115 1 hunks, 1 lines changed
115 1 hunks, 1 lines changed
116 \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc)
116 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m (esc)
117 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
117 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
118 c
118 c
119 a
119 a
120 a
120 a
121 \x1b[0;31m-b\x1b[0m (esc)
121 \x1b[0;31m-b\x1b[0m (esc)
122 \x1b[0;32m+dd\x1b[0m (esc)
122 \x1b[0;32m+dd\x1b[0m (esc)
123 a
123 a
124 a
124 a
125 c
125 c
126 \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc)
126 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m (esc)
@@ -1,1107 +1,1107 b''
1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
1 $ "$TESTDIR/hghave" symlink unix-permissions serve || exit 80
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > keyword =
5 > keyword =
6 > mq =
6 > mq =
7 > notify =
7 > notify =
8 > record =
8 > record =
9 > transplant =
9 > transplant =
10 > [ui]
10 > [ui]
11 > interactive = true
11 > interactive = true
12 > EOF
12 > EOF
13
13
14 Run kwdemo before [keyword] files are set up
14 Run kwdemo before [keyword] files are set up
15 as it would succeed without uisetup otherwise
15 as it would succeed without uisetup otherwise
16
16
17 $ hg --quiet kwdemo
17 $ hg --quiet kwdemo
18 [extensions]
18 [extensions]
19 keyword =
19 keyword =
20 [keyword]
20 [keyword]
21 demo.txt =
21 demo.txt =
22 [keywordset]
22 [keywordset]
23 svn = False
23 svn = False
24 [keywordmaps]
24 [keywordmaps]
25 Author = {author|user}
25 Author = {author|user}
26 Date = {date|utcdate}
26 Date = {date|utcdate}
27 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
27 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
28 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
28 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
29 RCSFile = {file|basename},v
29 RCSFile = {file|basename},v
30 RCSfile = {file|basename},v
30 RCSfile = {file|basename},v
31 Revision = {node|short}
31 Revision = {node|short}
32 Source = {root}/{file},v
32 Source = {root}/{file},v
33 $Author: test $
33 $Author: test $
34 $Date: ????/??/?? ??:??:?? $ (glob)
34 $Date: ????/??/?? ??:??:?? $ (glob)
35 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
35 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
36 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
36 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
37 $RCSFile: demo.txt,v $
37 $RCSFile: demo.txt,v $
38 $RCSfile: demo.txt,v $
38 $RCSfile: demo.txt,v $
39 $Revision: ???????????? $ (glob)
39 $Revision: ???????????? $ (glob)
40 $Source: */demo.txt,v $ (glob)
40 $Source: */demo.txt,v $ (glob)
41
41
42 $ hg --quiet kwdemo "Branch = {branches}"
42 $ hg --quiet kwdemo "Branch = {branches}"
43 [extensions]
43 [extensions]
44 keyword =
44 keyword =
45 [keyword]
45 [keyword]
46 demo.txt =
46 demo.txt =
47 [keywordset]
47 [keywordset]
48 svn = False
48 svn = False
49 [keywordmaps]
49 [keywordmaps]
50 Branch = {branches}
50 Branch = {branches}
51 $Branch: demobranch $
51 $Branch: demobranch $
52
52
53 $ cat <<EOF >> $HGRCPATH
53 $ cat <<EOF >> $HGRCPATH
54 > [keyword]
54 > [keyword]
55 > ** =
55 > ** =
56 > b = ignore
56 > b = ignore
57 > i = ignore
57 > i = ignore
58 > [hooks]
58 > [hooks]
59 > EOF
59 > EOF
60 $ cp $HGRCPATH $HGRCPATH.nohooks
60 $ cp $HGRCPATH $HGRCPATH.nohooks
61 > cat <<EOF >> $HGRCPATH
61 > cat <<EOF >> $HGRCPATH
62 > commit=
62 > commit=
63 > commit.test=cp a hooktest
63 > commit.test=cp a hooktest
64 > EOF
64 > EOF
65
65
66 $ hg init Test-bndl
66 $ hg init Test-bndl
67 $ cd Test-bndl
67 $ cd Test-bndl
68
68
69 kwshrink should exit silently in empty/invalid repo
69 kwshrink should exit silently in empty/invalid repo
70
70
71 $ hg kwshrink
71 $ hg kwshrink
72
72
73 Symlinks cannot be created on Windows.
73 Symlinks cannot be created on Windows.
74 A bundle to test this was made with:
74 A bundle to test this was made with:
75 hg init t
75 hg init t
76 cd t
76 cd t
77 echo a > a
77 echo a > a
78 ln -s a sym
78 ln -s a sym
79 hg add sym
79 hg add sym
80 hg ci -m addsym -u mercurial
80 hg ci -m addsym -u mercurial
81 hg bundle --base null ../test-keyword.hg
81 hg bundle --base null ../test-keyword.hg
82
82
83 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
83 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
84 pulling from *test-keyword.hg (glob)
84 pulling from *test-keyword.hg (glob)
85 requesting all changes
85 requesting all changes
86 adding changesets
86 adding changesets
87 adding manifests
87 adding manifests
88 adding file changes
88 adding file changes
89 added 1 changesets with 1 changes to 1 files
89 added 1 changesets with 1 changes to 1 files
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91
91
92 $ echo 'expand $Id$' > a
92 $ echo 'expand $Id$' > a
93 $ echo 'do not process $Id:' >> a
93 $ echo 'do not process $Id:' >> a
94 $ echo 'xxx $' >> a
94 $ echo 'xxx $' >> a
95 $ echo 'ignore $Id$' > b
95 $ echo 'ignore $Id$' > b
96
96
97 Output files as they were created
97 Output files as they were created
98
98
99 $ cat a b
99 $ cat a b
100 expand $Id$
100 expand $Id$
101 do not process $Id:
101 do not process $Id:
102 xxx $
102 xxx $
103 ignore $Id$
103 ignore $Id$
104
104
105 no kwfiles
105 no kwfiles
106
106
107 $ hg kwfiles
107 $ hg kwfiles
108
108
109 untracked candidates
109 untracked candidates
110
110
111 $ hg -v kwfiles --unknown
111 $ hg -v kwfiles --unknown
112 k a
112 k a
113
113
114 Add files and check status
114 Add files and check status
115
115
116 $ hg addremove
116 $ hg addremove
117 adding a
117 adding a
118 adding b
118 adding b
119 $ hg status
119 $ hg status
120 A a
120 A a
121 A b
121 A b
122
122
123
123
124 Default keyword expansion including commit hook
124 Default keyword expansion including commit hook
125 Interrupted commit should not change state or run commit hook
125 Interrupted commit should not change state or run commit hook
126
126
127 $ hg --debug commit
127 $ hg --debug commit
128 abort: empty commit message
128 abort: empty commit message
129 [255]
129 [255]
130 $ hg status
130 $ hg status
131 A a
131 A a
132 A b
132 A b
133
133
134 Commit with several checks
134 Commit with several checks
135
135
136 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
136 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
137 a
137 a
138 b
138 b
139 overwriting a expanding keywords
139 overwriting a expanding keywords
140 running hook commit.test: cp a hooktest
140 running hook commit.test: cp a hooktest
141 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
141 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
142 $ hg status
142 $ hg status
143 ? hooktest
143 ? hooktest
144 $ hg debugrebuildstate
144 $ hg debugrebuildstate
145 $ hg --quiet identify
145 $ hg --quiet identify
146 ef63ca68695b
146 ef63ca68695b
147
147
148 cat files in working directory with keywords expanded
148 cat files in working directory with keywords expanded
149
149
150 $ cat a b
150 $ cat a b
151 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
151 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
152 do not process $Id:
152 do not process $Id:
153 xxx $
153 xxx $
154 ignore $Id$
154 ignore $Id$
155
155
156 hg cat files and symlink, no expansion
156 hg cat files and symlink, no expansion
157
157
158 $ hg cat sym a b && echo
158 $ hg cat sym a b && echo
159 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
159 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
160 do not process $Id:
160 do not process $Id:
161 xxx $
161 xxx $
162 ignore $Id$
162 ignore $Id$
163 a
163 a
164
164
165 $ diff a hooktest
165 $ diff a hooktest
166
166
167 $ cp $HGRCPATH.nohooks $HGRCPATH
167 $ cp $HGRCPATH.nohooks $HGRCPATH
168 $ rm hooktest
168 $ rm hooktest
169
169
170 hg status of kw-ignored binary file starting with '\1\n'
170 hg status of kw-ignored binary file starting with '\1\n'
171
171
172 >>> open("i", "wb").write("\1\nfoo")
172 >>> open("i", "wb").write("\1\nfoo")
173 $ hg -q commit -Am metasep i
173 $ hg -q commit -Am metasep i
174 $ hg status
174 $ hg status
175 >>> open("i", "wb").write("\1\nbar")
175 >>> open("i", "wb").write("\1\nbar")
176 $ hg status
176 $ hg status
177 M i
177 M i
178 $ hg -q commit -m "modify metasep" i
178 $ hg -q commit -m "modify metasep" i
179 $ hg status --rev 2:3
179 $ hg status --rev 2:3
180 M i
180 M i
181 $ touch empty
181 $ touch empty
182 $ hg -q commit -A -m "another file"
182 $ hg -q commit -A -m "another file"
183 $ hg status -A --rev 3:4 i
183 $ hg status -A --rev 3:4 i
184 C i
184 C i
185
185
186 $ hg -q strip -n 2
186 $ hg -q strip -n 2
187
187
188 Test hook execution
188 Test hook execution
189
189
190 bundle
190 bundle
191
191
192 $ hg bundle --base null ../kw.hg
192 $ hg bundle --base null ../kw.hg
193 2 changesets found
193 2 changesets found
194 $ cd ..
194 $ cd ..
195 $ hg init Test
195 $ hg init Test
196 $ cd Test
196 $ cd Test
197
197
198 Notify on pull to check whether keywords stay as is in email
198 Notify on pull to check whether keywords stay as is in email
199 ie. if patch.diff wrapper acts as it should
199 ie. if patch.diff wrapper acts as it should
200
200
201 $ cat <<EOF >> $HGRCPATH
201 $ cat <<EOF >> $HGRCPATH
202 > [hooks]
202 > [hooks]
203 > incoming.notify = python:hgext.notify.hook
203 > incoming.notify = python:hgext.notify.hook
204 > [notify]
204 > [notify]
205 > sources = pull
205 > sources = pull
206 > diffstat = False
206 > diffstat = False
207 > maxsubject = 15
207 > maxsubject = 15
208 > [reposubs]
208 > [reposubs]
209 > * = Test
209 > * = Test
210 > EOF
210 > EOF
211
211
212 Pull from bundle and trigger notify
212 Pull from bundle and trigger notify
213
213
214 $ hg pull -u ../kw.hg
214 $ hg pull -u ../kw.hg
215 pulling from ../kw.hg
215 pulling from ../kw.hg
216 requesting all changes
216 requesting all changes
217 adding changesets
217 adding changesets
218 adding manifests
218 adding manifests
219 adding file changes
219 adding file changes
220 added 2 changesets with 3 changes to 3 files
220 added 2 changesets with 3 changes to 3 files
221 Content-Type: text/plain; charset="us-ascii"
221 Content-Type: text/plain; charset="us-ascii"
222 MIME-Version: 1.0
222 MIME-Version: 1.0
223 Content-Transfer-Encoding: 7bit
223 Content-Transfer-Encoding: 7bit
224 Date: * (glob)
224 Date: * (glob)
225 Subject: changeset in...
225 Subject: changeset in...
226 From: mercurial
226 From: mercurial
227 X-Hg-Notification: changeset a2392c293916
227 X-Hg-Notification: changeset a2392c293916
228 Message-Id: <hg.a2392c293916*> (glob)
228 Message-Id: <hg.a2392c293916*> (glob)
229 To: Test
229 To: Test
230
230
231 changeset a2392c293916 in $TESTTMP/Test (glob)
231 changeset a2392c293916 in $TESTTMP/Test (glob)
232 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
232 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
233 description:
233 description:
234 addsym
234 addsym
235
235
236 diffs (6 lines):
236 diffs (6 lines):
237
237
238 diff -r 000000000000 -r a2392c293916 sym
238 diff -r 000000000000 -r a2392c293916 sym
239 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
239 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
240 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
240 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
241 @@ -0,0 +1,1 @@
241 @@ -0,0 +1,1 @@
242 +a
242 +a
243 \ No newline at end of file
243 \ No newline at end of file
244 Content-Type: text/plain; charset="us-ascii"
244 Content-Type: text/plain; charset="us-ascii"
245 MIME-Version: 1.0
245 MIME-Version: 1.0
246 Content-Transfer-Encoding: 7bit
246 Content-Transfer-Encoding: 7bit
247 Date:* (glob)
247 Date:* (glob)
248 Subject: changeset in...
248 Subject: changeset in...
249 From: User Name <user@example.com>
249 From: User Name <user@example.com>
250 X-Hg-Notification: changeset ef63ca68695b
250 X-Hg-Notification: changeset ef63ca68695b
251 Message-Id: <hg.ef63ca68695b*> (glob)
251 Message-Id: <hg.ef63ca68695b*> (glob)
252 To: Test
252 To: Test
253
253
254 changeset ef63ca68695b in $TESTTMP/Test (glob)
254 changeset ef63ca68695b in $TESTTMP/Test (glob)
255 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
255 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
256 description:
256 description:
257 absym
257 absym
258
258
259 diffs (12 lines):
259 diffs (12 lines):
260
260
261 diff -r a2392c293916 -r ef63ca68695b a
261 diff -r a2392c293916 -r ef63ca68695b a
262 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
262 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
263 +++ b/a Thu Jan 01 00:00:00 1970 +0000
263 +++ b/a Thu Jan 01 00:00:00 1970 +0000
264 @@ -0,0 +1,3 @@
264 @@ -0,0 +1,3 @@
265 +expand $Id$
265 +expand $Id$
266 +do not process $Id:
266 +do not process $Id:
267 +xxx $
267 +xxx $
268 diff -r a2392c293916 -r ef63ca68695b b
268 diff -r a2392c293916 -r ef63ca68695b b
269 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
269 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
270 +++ b/b Thu Jan 01 00:00:00 1970 +0000
270 +++ b/b Thu Jan 01 00:00:00 1970 +0000
271 @@ -0,0 +1,1 @@
271 @@ -0,0 +1,1 @@
272 +ignore $Id$
272 +ignore $Id$
273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
274
274
275 $ cp $HGRCPATH.nohooks $HGRCPATH
275 $ cp $HGRCPATH.nohooks $HGRCPATH
276
276
277 Touch files and check with status
277 Touch files and check with status
278
278
279 $ touch a b
279 $ touch a b
280 $ hg status
280 $ hg status
281
281
282 Update and expand
282 Update and expand
283
283
284 $ rm sym a b
284 $ rm sym a b
285 $ hg update -C
285 $ hg update -C
286 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
286 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 $ cat a b
287 $ cat a b
288 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
288 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
289 do not process $Id:
289 do not process $Id:
290 xxx $
290 xxx $
291 ignore $Id$
291 ignore $Id$
292
292
293 Check whether expansion is filewise and file mode is preserved
293 Check whether expansion is filewise and file mode is preserved
294
294
295 $ echo '$Id$' > c
295 $ echo '$Id$' > c
296 $ echo 'tests for different changenodes' >> c
296 $ echo 'tests for different changenodes' >> c
297 $ chmod 600 c
297 $ chmod 600 c
298 $ ls -l c | cut -b 1-10
298 $ ls -l c | cut -b 1-10
299 -rw-------
299 -rw-------
300
300
301 commit file c
301 commit file c
302
302
303 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
303 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
304 adding c
304 adding c
305 $ ls -l c | cut -b 1-10
305 $ ls -l c | cut -b 1-10
306 -rw-------
306 -rw-------
307
307
308 force expansion
308 force expansion
309
309
310 $ hg -v kwexpand
310 $ hg -v kwexpand
311 overwriting a expanding keywords
311 overwriting a expanding keywords
312 overwriting c expanding keywords
312 overwriting c expanding keywords
313
313
314 compare changenodes in a and c
314 compare changenodes in a and c
315
315
316 $ cat a c
316 $ cat a c
317 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
317 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
318 do not process $Id:
318 do not process $Id:
319 xxx $
319 xxx $
320 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
320 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
321 tests for different changenodes
321 tests for different changenodes
322
322
323 record
323 record
324
324
325 $ echo '$Id$' > r
325 $ echo '$Id$' > r
326 $ hg add r
326 $ hg add r
327
327
328 record chunk
328 record chunk
329
329
330 >>> lines = open('a').readlines()
330 >>> lines = open('a').readlines()
331 >>> lines.insert(1, 'foo\n')
331 >>> lines.insert(1, 'foo\n')
332 >>> lines.append('bar\n')
332 >>> lines.append('bar\n')
333 >>> open('a', 'w').writelines(lines)
333 >>> open('a', 'w').writelines(lines)
334 $ hg record -d '1 10' -m rectest a<<EOF
334 $ hg record -d '1 10' -m rectest a<<EOF
335 > y
335 > y
336 > y
336 > y
337 > n
337 > n
338 > EOF
338 > EOF
339 diff --git a/a b/a
339 diff --git a/a b/a
340 2 hunks, 2 lines changed
340 2 hunks, 2 lines changed
341 examine changes to 'a'? [Ynsfdaq?]
341 examine changes to 'a'? [Ynesfdaq?]
342 @@ -1,3 +1,4 @@
342 @@ -1,3 +1,4 @@
343 expand $Id$
343 expand $Id$
344 +foo
344 +foo
345 do not process $Id:
345 do not process $Id:
346 xxx $
346 xxx $
347 record change 1/2 to 'a'? [Ynsfdaq?]
347 record change 1/2 to 'a'? [Ynesfdaq?]
348 @@ -2,2 +3,3 @@
348 @@ -2,2 +3,3 @@
349 do not process $Id:
349 do not process $Id:
350 xxx $
350 xxx $
351 +bar
351 +bar
352 record change 2/2 to 'a'? [Ynsfdaq?]
352 record change 2/2 to 'a'? [Ynesfdaq?]
353
353
354 $ hg identify
354 $ hg identify
355 d17e03c92c97+ tip
355 d17e03c92c97+ tip
356 $ hg status
356 $ hg status
357 M a
357 M a
358 A r
358 A r
359
359
360 Cat modified file a
360 Cat modified file a
361
361
362 $ cat a
362 $ cat a
363 expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
363 expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
364 foo
364 foo
365 do not process $Id:
365 do not process $Id:
366 xxx $
366 xxx $
367 bar
367 bar
368
368
369 Diff remaining chunk
369 Diff remaining chunk
370
370
371 $ hg diff a
371 $ hg diff a
372 diff -r d17e03c92c97 a
372 diff -r d17e03c92c97 a
373 --- a/a Wed Dec 31 23:59:51 1969 -0000
373 --- a/a Wed Dec 31 23:59:51 1969 -0000
374 +++ b/a * (glob)
374 +++ b/a * (glob)
375 @@ -2,3 +2,4 @@
375 @@ -2,3 +2,4 @@
376 foo
376 foo
377 do not process $Id:
377 do not process $Id:
378 xxx $
378 xxx $
379 +bar
379 +bar
380
380
381 $ hg rollback
381 $ hg rollback
382 repository tip rolled back to revision 2 (undo commit)
382 repository tip rolled back to revision 2 (undo commit)
383 working directory now based on revision 2
383 working directory now based on revision 2
384
384
385 Record all chunks in file a
385 Record all chunks in file a
386
386
387 $ echo foo > msg
387 $ echo foo > msg
388
388
389 - do not use "hg record -m" here!
389 - do not use "hg record -m" here!
390
390
391 $ hg record -l msg -d '1 11' a<<EOF
391 $ hg record -l msg -d '1 11' a<<EOF
392 > y
392 > y
393 > y
393 > y
394 > y
394 > y
395 > EOF
395 > EOF
396 diff --git a/a b/a
396 diff --git a/a b/a
397 2 hunks, 2 lines changed
397 2 hunks, 2 lines changed
398 examine changes to 'a'? [Ynsfdaq?]
398 examine changes to 'a'? [Ynesfdaq?]
399 @@ -1,3 +1,4 @@
399 @@ -1,3 +1,4 @@
400 expand $Id$
400 expand $Id$
401 +foo
401 +foo
402 do not process $Id:
402 do not process $Id:
403 xxx $
403 xxx $
404 record change 1/2 to 'a'? [Ynsfdaq?]
404 record change 1/2 to 'a'? [Ynesfdaq?]
405 @@ -2,2 +3,3 @@
405 @@ -2,2 +3,3 @@
406 do not process $Id:
406 do not process $Id:
407 xxx $
407 xxx $
408 +bar
408 +bar
409 record change 2/2 to 'a'? [Ynsfdaq?]
409 record change 2/2 to 'a'? [Ynesfdaq?]
410
410
411 File a should be clean
411 File a should be clean
412
412
413 $ hg status -A a
413 $ hg status -A a
414 C a
414 C a
415
415
416 rollback and revert expansion
416 rollback and revert expansion
417
417
418 $ cat a
418 $ cat a
419 expand $Id: a,v 59f969a3b52c 1970/01/01 00:00:01 test $
419 expand $Id: a,v 59f969a3b52c 1970/01/01 00:00:01 test $
420 foo
420 foo
421 do not process $Id:
421 do not process $Id:
422 xxx $
422 xxx $
423 bar
423 bar
424 $ hg --verbose rollback
424 $ hg --verbose rollback
425 repository tip rolled back to revision 2 (undo commit)
425 repository tip rolled back to revision 2 (undo commit)
426 working directory now based on revision 2
426 working directory now based on revision 2
427 overwriting a expanding keywords
427 overwriting a expanding keywords
428 $ hg status a
428 $ hg status a
429 M a
429 M a
430 $ cat a
430 $ cat a
431 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
431 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
432 foo
432 foo
433 do not process $Id:
433 do not process $Id:
434 xxx $
434 xxx $
435 bar
435 bar
436 $ echo '$Id$' > y
436 $ echo '$Id$' > y
437 $ echo '$Id$' > z
437 $ echo '$Id$' > z
438 $ hg add y
438 $ hg add y
439 $ hg commit -Am "rollback only" z
439 $ hg commit -Am "rollback only" z
440 $ cat z
440 $ cat z
441 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
441 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
442 $ hg --verbose rollback
442 $ hg --verbose rollback
443 repository tip rolled back to revision 2 (undo commit)
443 repository tip rolled back to revision 2 (undo commit)
444 working directory now based on revision 2
444 working directory now based on revision 2
445 overwriting z shrinking keywords
445 overwriting z shrinking keywords
446
446
447 Only z should be overwritten
447 Only z should be overwritten
448
448
449 $ hg status a y z
449 $ hg status a y z
450 M a
450 M a
451 A y
451 A y
452 A z
452 A z
453 $ cat z
453 $ cat z
454 $Id$
454 $Id$
455 $ hg forget y z
455 $ hg forget y z
456 $ rm y z
456 $ rm y z
457
457
458 record added file alone
458 record added file alone
459
459
460 $ hg -v record -l msg -d '1 12' r<<EOF
460 $ hg -v record -l msg -d '1 12' r<<EOF
461 > y
461 > y
462 > EOF
462 > EOF
463 diff --git a/r b/r
463 diff --git a/r b/r
464 new file mode 100644
464 new file mode 100644
465 examine changes to 'r'? [Ynsfdaq?]
465 examine changes to 'r'? [Ynesfdaq?]
466 r
466 r
467 committed changeset 3:899491280810
467 committed changeset 3:899491280810
468 overwriting r expanding keywords
468 overwriting r expanding keywords
469 - status call required for dirstate.normallookup() check
469 - status call required for dirstate.normallookup() check
470 $ hg status r
470 $ hg status r
471 $ hg --verbose rollback
471 $ hg --verbose rollback
472 repository tip rolled back to revision 2 (undo commit)
472 repository tip rolled back to revision 2 (undo commit)
473 working directory now based on revision 2
473 working directory now based on revision 2
474 overwriting r shrinking keywords
474 overwriting r shrinking keywords
475 $ hg forget r
475 $ hg forget r
476 $ rm msg r
476 $ rm msg r
477 $ hg update -C
477 $ hg update -C
478 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
478 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
479
479
480 record added keyword ignored file
480 record added keyword ignored file
481
481
482 $ echo '$Id$' > i
482 $ echo '$Id$' > i
483 $ hg add i
483 $ hg add i
484 $ hg --verbose record -d '1 13' -m recignored<<EOF
484 $ hg --verbose record -d '1 13' -m recignored<<EOF
485 > y
485 > y
486 > EOF
486 > EOF
487 diff --git a/i b/i
487 diff --git a/i b/i
488 new file mode 100644
488 new file mode 100644
489 examine changes to 'i'? [Ynsfdaq?]
489 examine changes to 'i'? [Ynesfdaq?]
490 i
490 i
491 committed changeset 3:5f40fe93bbdc
491 committed changeset 3:5f40fe93bbdc
492 $ cat i
492 $ cat i
493 $Id$
493 $Id$
494 $ hg -q rollback
494 $ hg -q rollback
495 $ hg forget i
495 $ hg forget i
496 $ rm i
496 $ rm i
497
497
498 Test patch queue repo
498 Test patch queue repo
499
499
500 $ hg init --mq
500 $ hg init --mq
501 $ hg qimport -r tip -n mqtest.diff
501 $ hg qimport -r tip -n mqtest.diff
502 $ hg commit --mq -m mqtest
502 $ hg commit --mq -m mqtest
503
503
504 Keywords should not be expanded in patch
504 Keywords should not be expanded in patch
505
505
506 $ cat .hg/patches/mqtest.diff
506 $ cat .hg/patches/mqtest.diff
507 # HG changeset patch
507 # HG changeset patch
508 # User User Name <user@example.com>
508 # User User Name <user@example.com>
509 # Date 1 0
509 # Date 1 0
510 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
510 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
511 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
511 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
512 cndiff
512 cndiff
513
513
514 diff -r ef63ca68695b -r 40a904bbbe4c c
514 diff -r ef63ca68695b -r 40a904bbbe4c c
515 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
515 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
516 +++ b/c Thu Jan 01 00:00:01 1970 +0000
516 +++ b/c Thu Jan 01 00:00:01 1970 +0000
517 @@ -0,0 +1,2 @@
517 @@ -0,0 +1,2 @@
518 +$Id$
518 +$Id$
519 +tests for different changenodes
519 +tests for different changenodes
520
520
521 $ hg qpop
521 $ hg qpop
522 popping mqtest.diff
522 popping mqtest.diff
523 patch queue now empty
523 patch queue now empty
524
524
525 qgoto, implying qpush, should expand
525 qgoto, implying qpush, should expand
526
526
527 $ hg qgoto mqtest.diff
527 $ hg qgoto mqtest.diff
528 applying mqtest.diff
528 applying mqtest.diff
529 now at: mqtest.diff
529 now at: mqtest.diff
530 $ cat c
530 $ cat c
531 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
531 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
532 tests for different changenodes
532 tests for different changenodes
533 $ hg cat c
533 $ hg cat c
534 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
534 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
535 tests for different changenodes
535 tests for different changenodes
536
536
537 Keywords should not be expanded in filelog
537 Keywords should not be expanded in filelog
538
538
539 $ hg --config 'extensions.keyword=!' cat c
539 $ hg --config 'extensions.keyword=!' cat c
540 $Id$
540 $Id$
541 tests for different changenodes
541 tests for different changenodes
542
542
543 qpop and move on
543 qpop and move on
544
544
545 $ hg qpop
545 $ hg qpop
546 popping mqtest.diff
546 popping mqtest.diff
547 patch queue now empty
547 patch queue now empty
548
548
549 Copy and show added kwfiles
549 Copy and show added kwfiles
550
550
551 $ hg cp a c
551 $ hg cp a c
552 $ hg kwfiles
552 $ hg kwfiles
553 a
553 a
554 c
554 c
555
555
556 Commit and show expansion in original and copy
556 Commit and show expansion in original and copy
557
557
558 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
558 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
559 c
559 c
560 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
560 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
561 overwriting c expanding keywords
561 overwriting c expanding keywords
562 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
562 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
563 $ cat a c
563 $ cat a c
564 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
564 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
565 do not process $Id:
565 do not process $Id:
566 xxx $
566 xxx $
567 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
567 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
568 do not process $Id:
568 do not process $Id:
569 xxx $
569 xxx $
570
570
571 Touch copied c and check its status
571 Touch copied c and check its status
572
572
573 $ touch c
573 $ touch c
574 $ hg status
574 $ hg status
575
575
576 Copy kwfile to keyword ignored file unexpanding keywords
576 Copy kwfile to keyword ignored file unexpanding keywords
577
577
578 $ hg --verbose copy a i
578 $ hg --verbose copy a i
579 copying a to i
579 copying a to i
580 overwriting i shrinking keywords
580 overwriting i shrinking keywords
581 $ head -n 1 i
581 $ head -n 1 i
582 expand $Id$
582 expand $Id$
583 $ hg forget i
583 $ hg forget i
584 $ rm i
584 $ rm i
585
585
586 Copy ignored file to ignored file: no overwriting
586 Copy ignored file to ignored file: no overwriting
587
587
588 $ hg --verbose copy b i
588 $ hg --verbose copy b i
589 copying b to i
589 copying b to i
590 $ hg forget i
590 $ hg forget i
591 $ rm i
591 $ rm i
592
592
593 cp symlink file; hg cp -A symlink file (part1)
593 cp symlink file; hg cp -A symlink file (part1)
594 - copied symlink points to kwfile: overwrite
594 - copied symlink points to kwfile: overwrite
595
595
596 $ cp sym i
596 $ cp sym i
597 $ ls -l i
597 $ ls -l i
598 -rw-r--r--* (glob)
598 -rw-r--r--* (glob)
599 $ head -1 i
599 $ head -1 i
600 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
600 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
601 $ hg copy --after --verbose sym i
601 $ hg copy --after --verbose sym i
602 copying sym to i
602 copying sym to i
603 overwriting i shrinking keywords
603 overwriting i shrinking keywords
604 $ head -1 i
604 $ head -1 i
605 expand $Id$
605 expand $Id$
606 $ hg forget i
606 $ hg forget i
607 $ rm i
607 $ rm i
608
608
609 Test different options of hg kwfiles
609 Test different options of hg kwfiles
610
610
611 $ hg kwfiles
611 $ hg kwfiles
612 a
612 a
613 c
613 c
614 $ hg -v kwfiles --ignore
614 $ hg -v kwfiles --ignore
615 I b
615 I b
616 I sym
616 I sym
617 $ hg kwfiles --all
617 $ hg kwfiles --all
618 K a
618 K a
619 K c
619 K c
620 I b
620 I b
621 I sym
621 I sym
622
622
623 Diff specific revision
623 Diff specific revision
624
624
625 $ hg diff --rev 1
625 $ hg diff --rev 1
626 diff -r ef63ca68695b c
626 diff -r ef63ca68695b c
627 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
627 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
628 +++ b/c * (glob)
628 +++ b/c * (glob)
629 @@ -0,0 +1,3 @@
629 @@ -0,0 +1,3 @@
630 +expand $Id$
630 +expand $Id$
631 +do not process $Id:
631 +do not process $Id:
632 +xxx $
632 +xxx $
633
633
634 Status after rollback:
634 Status after rollback:
635
635
636 $ hg rollback
636 $ hg rollback
637 repository tip rolled back to revision 1 (undo commit)
637 repository tip rolled back to revision 1 (undo commit)
638 working directory now based on revision 1
638 working directory now based on revision 1
639 $ hg status
639 $ hg status
640 A c
640 A c
641 $ hg update --clean
641 $ hg update --clean
642 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
642 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
643
643
644 cp symlink file; hg cp -A symlink file (part2)
644 cp symlink file; hg cp -A symlink file (part2)
645 - copied symlink points to kw ignored file: do not overwrite
645 - copied symlink points to kw ignored file: do not overwrite
646
646
647 $ cat a > i
647 $ cat a > i
648 $ ln -s i symignored
648 $ ln -s i symignored
649 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
649 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
650 $ cp symignored x
650 $ cp symignored x
651 $ hg copy --after --verbose symignored x
651 $ hg copy --after --verbose symignored x
652 copying symignored to x
652 copying symignored to x
653 $ head -n 1 x
653 $ head -n 1 x
654 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
654 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
655 $ hg forget x
655 $ hg forget x
656 $ rm x
656 $ rm x
657
657
658 $ hg rollback
658 $ hg rollback
659 repository tip rolled back to revision 1 (undo commit)
659 repository tip rolled back to revision 1 (undo commit)
660 working directory now based on revision 1
660 working directory now based on revision 1
661 $ hg update --clean
661 $ hg update --clean
662 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
662 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
663 $ rm i symignored
663 $ rm i symignored
664
664
665 Custom keywordmaps as argument to kwdemo
665 Custom keywordmaps as argument to kwdemo
666
666
667 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
667 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
668 [extensions]
668 [extensions]
669 keyword =
669 keyword =
670 [keyword]
670 [keyword]
671 ** =
671 ** =
672 b = ignore
672 b = ignore
673 demo.txt =
673 demo.txt =
674 i = ignore
674 i = ignore
675 [keywordset]
675 [keywordset]
676 svn = False
676 svn = False
677 [keywordmaps]
677 [keywordmaps]
678 Xinfo = {author}: {desc}
678 Xinfo = {author}: {desc}
679 $Xinfo: test: hg keyword configuration and expansion example $
679 $Xinfo: test: hg keyword configuration and expansion example $
680
680
681 Configure custom keywordmaps
681 Configure custom keywordmaps
682
682
683 $ cat <<EOF >>$HGRCPATH
683 $ cat <<EOF >>$HGRCPATH
684 > [keywordmaps]
684 > [keywordmaps]
685 > Id = {file} {node|short} {date|rfc822date} {author|user}
685 > Id = {file} {node|short} {date|rfc822date} {author|user}
686 > Xinfo = {author}: {desc}
686 > Xinfo = {author}: {desc}
687 > EOF
687 > EOF
688
688
689 Cat and hg cat files before custom expansion
689 Cat and hg cat files before custom expansion
690
690
691 $ cat a b
691 $ cat a b
692 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
692 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
693 do not process $Id:
693 do not process $Id:
694 xxx $
694 xxx $
695 ignore $Id$
695 ignore $Id$
696 $ hg cat sym a b && echo
696 $ hg cat sym a b && echo
697 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
697 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
698 do not process $Id:
698 do not process $Id:
699 xxx $
699 xxx $
700 ignore $Id$
700 ignore $Id$
701 a
701 a
702
702
703 Write custom keyword and prepare multiline commit message
703 Write custom keyword and prepare multiline commit message
704
704
705 $ echo '$Xinfo$' >> a
705 $ echo '$Xinfo$' >> a
706 $ cat <<EOF >> log
706 $ cat <<EOF >> log
707 > firstline
707 > firstline
708 > secondline
708 > secondline
709 > EOF
709 > EOF
710
710
711 Interrupted commit should not change state
711 Interrupted commit should not change state
712
712
713 $ hg commit
713 $ hg commit
714 abort: empty commit message
714 abort: empty commit message
715 [255]
715 [255]
716 $ hg status
716 $ hg status
717 M a
717 M a
718 ? c
718 ? c
719 ? log
719 ? log
720
720
721 Commit with multiline message and custom expansion
721 Commit with multiline message and custom expansion
722
722
723 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
723 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
724 a
724 a
725 overwriting a expanding keywords
725 overwriting a expanding keywords
726 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
726 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
727 $ rm log
727 $ rm log
728
728
729 Stat, verify and show custom expansion (firstline)
729 Stat, verify and show custom expansion (firstline)
730
730
731 $ hg status
731 $ hg status
732 ? c
732 ? c
733 $ hg verify
733 $ hg verify
734 checking changesets
734 checking changesets
735 checking manifests
735 checking manifests
736 crosschecking files in changesets and manifests
736 crosschecking files in changesets and manifests
737 checking files
737 checking files
738 3 files, 3 changesets, 4 total revisions
738 3 files, 3 changesets, 4 total revisions
739 $ cat a b
739 $ cat a b
740 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
740 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
741 do not process $Id:
741 do not process $Id:
742 xxx $
742 xxx $
743 $Xinfo: User Name <user@example.com>: firstline $
743 $Xinfo: User Name <user@example.com>: firstline $
744 ignore $Id$
744 ignore $Id$
745 $ hg cat sym a b && echo
745 $ hg cat sym a b && echo
746 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
746 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
747 do not process $Id:
747 do not process $Id:
748 xxx $
748 xxx $
749 $Xinfo: User Name <user@example.com>: firstline $
749 $Xinfo: User Name <user@example.com>: firstline $
750 ignore $Id$
750 ignore $Id$
751 a
751 a
752
752
753 annotate
753 annotate
754
754
755 $ hg annotate a
755 $ hg annotate a
756 1: expand $Id$
756 1: expand $Id$
757 1: do not process $Id:
757 1: do not process $Id:
758 1: xxx $
758 1: xxx $
759 2: $Xinfo$
759 2: $Xinfo$
760
760
761 remove with status checks
761 remove with status checks
762
762
763 $ hg debugrebuildstate
763 $ hg debugrebuildstate
764 $ hg remove a
764 $ hg remove a
765 $ hg --debug commit -m rma
765 $ hg --debug commit -m rma
766 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
766 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
767 $ hg status
767 $ hg status
768 ? c
768 ? c
769
769
770 Rollback, revert, and check expansion
770 Rollback, revert, and check expansion
771
771
772 $ hg rollback
772 $ hg rollback
773 repository tip rolled back to revision 2 (undo commit)
773 repository tip rolled back to revision 2 (undo commit)
774 working directory now based on revision 2
774 working directory now based on revision 2
775 $ hg status
775 $ hg status
776 R a
776 R a
777 ? c
777 ? c
778 $ hg revert --no-backup --rev tip a
778 $ hg revert --no-backup --rev tip a
779 $ cat a
779 $ cat a
780 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
780 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
781 do not process $Id:
781 do not process $Id:
782 xxx $
782 xxx $
783 $Xinfo: User Name <user@example.com>: firstline $
783 $Xinfo: User Name <user@example.com>: firstline $
784
784
785 Clone to test global and local configurations
785 Clone to test global and local configurations
786
786
787 $ cd ..
787 $ cd ..
788
788
789 Expansion in destinaton with global configuration
789 Expansion in destinaton with global configuration
790
790
791 $ hg --quiet clone Test globalconf
791 $ hg --quiet clone Test globalconf
792 $ cat globalconf/a
792 $ cat globalconf/a
793 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
793 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
794 do not process $Id:
794 do not process $Id:
795 xxx $
795 xxx $
796 $Xinfo: User Name <user@example.com>: firstline $
796 $Xinfo: User Name <user@example.com>: firstline $
797
797
798 No expansion in destination with local configuration in origin only
798 No expansion in destination with local configuration in origin only
799
799
800 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
800 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
801 $ cat localconf/a
801 $ cat localconf/a
802 expand $Id$
802 expand $Id$
803 do not process $Id:
803 do not process $Id:
804 xxx $
804 xxx $
805 $Xinfo$
805 $Xinfo$
806
806
807 Clone to test incoming
807 Clone to test incoming
808
808
809 $ hg clone -r1 Test Test-a
809 $ hg clone -r1 Test Test-a
810 adding changesets
810 adding changesets
811 adding manifests
811 adding manifests
812 adding file changes
812 adding file changes
813 added 2 changesets with 3 changes to 3 files
813 added 2 changesets with 3 changes to 3 files
814 updating to branch default
814 updating to branch default
815 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
815 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
816 $ cd Test-a
816 $ cd Test-a
817 $ cat <<EOF >> .hg/hgrc
817 $ cat <<EOF >> .hg/hgrc
818 > [paths]
818 > [paths]
819 > default = ../Test
819 > default = ../Test
820 > EOF
820 > EOF
821 $ hg incoming
821 $ hg incoming
822 comparing with $TESTTMP/Test (glob)
822 comparing with $TESTTMP/Test (glob)
823 searching for changes
823 searching for changes
824 changeset: 2:bb948857c743
824 changeset: 2:bb948857c743
825 tag: tip
825 tag: tip
826 user: User Name <user@example.com>
826 user: User Name <user@example.com>
827 date: Thu Jan 01 00:00:02 1970 +0000
827 date: Thu Jan 01 00:00:02 1970 +0000
828 summary: firstline
828 summary: firstline
829
829
830 Imported patch should not be rejected
830 Imported patch should not be rejected
831
831
832 >>> import re
832 >>> import re
833 >>> text = re.sub(r'(Id.*)', r'\1 rejecttest', open('a').read())
833 >>> text = re.sub(r'(Id.*)', r'\1 rejecttest', open('a').read())
834 >>> open('a', 'wb').write(text)
834 >>> open('a', 'wb').write(text)
835 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
835 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
836 a
836 a
837 overwriting a expanding keywords
837 overwriting a expanding keywords
838 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
838 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
839 $ hg export -o ../rejecttest.diff tip
839 $ hg export -o ../rejecttest.diff tip
840 $ cd ../Test
840 $ cd ../Test
841 $ hg import ../rejecttest.diff
841 $ hg import ../rejecttest.diff
842 applying ../rejecttest.diff
842 applying ../rejecttest.diff
843 $ cat a b
843 $ cat a b
844 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
844 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
845 do not process $Id: rejecttest
845 do not process $Id: rejecttest
846 xxx $
846 xxx $
847 $Xinfo: User Name <user@example.com>: rejects? $
847 $Xinfo: User Name <user@example.com>: rejects? $
848 ignore $Id$
848 ignore $Id$
849
849
850 $ hg rollback
850 $ hg rollback
851 repository tip rolled back to revision 2 (undo import)
851 repository tip rolled back to revision 2 (undo import)
852 working directory now based on revision 2
852 working directory now based on revision 2
853 $ hg update --clean
853 $ hg update --clean
854 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
854 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
855
855
856 kwexpand/kwshrink on selected files
856 kwexpand/kwshrink on selected files
857
857
858 $ mkdir x
858 $ mkdir x
859 $ hg copy a x/a
859 $ hg copy a x/a
860 $ hg --verbose kwshrink a
860 $ hg --verbose kwshrink a
861 overwriting a shrinking keywords
861 overwriting a shrinking keywords
862 - sleep required for dirstate.normal() check
862 - sleep required for dirstate.normal() check
863 $ sleep 1
863 $ sleep 1
864 $ hg status a
864 $ hg status a
865 $ hg --verbose kwexpand a
865 $ hg --verbose kwexpand a
866 overwriting a expanding keywords
866 overwriting a expanding keywords
867 $ hg status a
867 $ hg status a
868
868
869 kwexpand x/a should abort
869 kwexpand x/a should abort
870
870
871 $ hg --verbose kwexpand x/a
871 $ hg --verbose kwexpand x/a
872 abort: outstanding uncommitted changes
872 abort: outstanding uncommitted changes
873 [255]
873 [255]
874 $ cd x
874 $ cd x
875 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
875 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
876 x/a
876 x/a
877 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
877 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
878 overwriting x/a expanding keywords
878 overwriting x/a expanding keywords
879 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
879 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
880 $ cat a
880 $ cat a
881 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
881 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
882 do not process $Id:
882 do not process $Id:
883 xxx $
883 xxx $
884 $Xinfo: User Name <user@example.com>: xa $
884 $Xinfo: User Name <user@example.com>: xa $
885
885
886 kwshrink a inside directory x
886 kwshrink a inside directory x
887
887
888 $ hg --verbose kwshrink a
888 $ hg --verbose kwshrink a
889 overwriting x/a shrinking keywords
889 overwriting x/a shrinking keywords
890 $ cat a
890 $ cat a
891 expand $Id$
891 expand $Id$
892 do not process $Id:
892 do not process $Id:
893 xxx $
893 xxx $
894 $Xinfo$
894 $Xinfo$
895 $ cd ..
895 $ cd ..
896
896
897 kwexpand nonexistent
897 kwexpand nonexistent
898
898
899 $ hg kwexpand nonexistent
899 $ hg kwexpand nonexistent
900 nonexistent:* (glob)
900 nonexistent:* (glob)
901
901
902
902
903 hg serve
903 hg serve
904 - expand with hgweb file
904 - expand with hgweb file
905 - no expansion with hgweb annotate/changeset/filediff
905 - no expansion with hgweb annotate/changeset/filediff
906 - check errors
906 - check errors
907
907
908 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
908 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
909 $ cat hg.pid >> $DAEMON_PIDS
909 $ cat hg.pid >> $DAEMON_PIDS
910 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
910 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
911 200 Script output follows
911 200 Script output follows
912
912
913 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
913 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
914 do not process $Id:
914 do not process $Id:
915 xxx $
915 xxx $
916 $Xinfo: User Name <user@example.com>: firstline $
916 $Xinfo: User Name <user@example.com>: firstline $
917 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
917 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
918 200 Script output follows
918 200 Script output follows
919
919
920
920
921 user@1: expand $Id$
921 user@1: expand $Id$
922 user@1: do not process $Id:
922 user@1: do not process $Id:
923 user@1: xxx $
923 user@1: xxx $
924 user@2: $Xinfo$
924 user@2: $Xinfo$
925
925
926
926
927
927
928
928
929 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
929 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
930 200 Script output follows
930 200 Script output follows
931
931
932
932
933 # HG changeset patch
933 # HG changeset patch
934 # User User Name <user@example.com>
934 # User User Name <user@example.com>
935 # Date 3 0
935 # Date 3 0
936 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
936 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
937 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
937 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
938 xa
938 xa
939
939
940 diff -r bb948857c743 -r b4560182a3f9 x/a
940 diff -r bb948857c743 -r b4560182a3f9 x/a
941 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
941 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
942 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
942 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
943 @@ -0,0 +1,4 @@
943 @@ -0,0 +1,4 @@
944 +expand $Id$
944 +expand $Id$
945 +do not process $Id:
945 +do not process $Id:
946 +xxx $
946 +xxx $
947 +$Xinfo$
947 +$Xinfo$
948
948
949 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
949 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
950 200 Script output follows
950 200 Script output follows
951
951
952
952
953 diff -r ef63ca68695b -r bb948857c743 a
953 diff -r ef63ca68695b -r bb948857c743 a
954 --- a/a Thu Jan 01 00:00:00 1970 +0000
954 --- a/a Thu Jan 01 00:00:00 1970 +0000
955 +++ b/a Thu Jan 01 00:00:02 1970 +0000
955 +++ b/a Thu Jan 01 00:00:02 1970 +0000
956 @@ -1,3 +1,4 @@
956 @@ -1,3 +1,4 @@
957 expand $Id$
957 expand $Id$
958 do not process $Id:
958 do not process $Id:
959 xxx $
959 xxx $
960 +$Xinfo$
960 +$Xinfo$
961
961
962
962
963
963
964
964
965 $ cat errors.log
965 $ cat errors.log
966
966
967 Prepare merge and resolve tests
967 Prepare merge and resolve tests
968
968
969 $ echo '$Id$' > m
969 $ echo '$Id$' > m
970 $ hg add m
970 $ hg add m
971 $ hg commit -m 4kw
971 $ hg commit -m 4kw
972 $ echo foo >> m
972 $ echo foo >> m
973 $ hg commit -m 5foo
973 $ hg commit -m 5foo
974
974
975 simplemerge
975 simplemerge
976
976
977 $ hg update 4
977 $ hg update 4
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
978 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
979 $ echo foo >> m
979 $ echo foo >> m
980 $ hg commit -m 6foo
980 $ hg commit -m 6foo
981 created new head
981 created new head
982 $ hg merge
982 $ hg merge
983 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
983 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
984 (branch merge, don't forget to commit)
984 (branch merge, don't forget to commit)
985 $ hg commit -m simplemerge
985 $ hg commit -m simplemerge
986 $ cat m
986 $ cat m
987 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
987 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
988 foo
988 foo
989
989
990 conflict: keyword should stay outside conflict zone
990 conflict: keyword should stay outside conflict zone
991
991
992 $ hg update 4
992 $ hg update 4
993 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
993 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
994 $ echo bar >> m
994 $ echo bar >> m
995 $ hg commit -m 8bar
995 $ hg commit -m 8bar
996 created new head
996 created new head
997 $ hg merge
997 $ hg merge
998 merging m
998 merging m
999 warning: conflicts during merge.
999 warning: conflicts during merge.
1000 merging m incomplete! (edit conflicts, then use 'hg resolve --mark')
1000 merging m incomplete! (edit conflicts, then use 'hg resolve --mark')
1001 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1001 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1002 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1002 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1003 [1]
1003 [1]
1004 $ cat m
1004 $ cat m
1005 $Id$
1005 $Id$
1006 <<<<<<< local
1006 <<<<<<< local
1007 bar
1007 bar
1008 =======
1008 =======
1009 foo
1009 foo
1010 >>>>>>> other
1010 >>>>>>> other
1011
1011
1012 resolve to local
1012 resolve to local
1013
1013
1014 $ HGMERGE=internal:local hg resolve -a
1014 $ HGMERGE=internal:local hg resolve -a
1015 $ hg commit -m localresolve
1015 $ hg commit -m localresolve
1016 $ cat m
1016 $ cat m
1017 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1017 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
1018 bar
1018 bar
1019
1019
1020 Test restricted mode with transplant -b
1020 Test restricted mode with transplant -b
1021
1021
1022 $ hg update 6
1022 $ hg update 6
1023 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1023 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1024 $ hg branch foo
1024 $ hg branch foo
1025 marked working directory as branch foo
1025 marked working directory as branch foo
1026 (branches are permanent and global, did you want a bookmark?)
1026 (branches are permanent and global, did you want a bookmark?)
1027 $ mv a a.bak
1027 $ mv a a.bak
1028 $ echo foobranch > a
1028 $ echo foobranch > a
1029 $ cat a.bak >> a
1029 $ cat a.bak >> a
1030 $ rm a.bak
1030 $ rm a.bak
1031 $ hg commit -m 9foobranch
1031 $ hg commit -m 9foobranch
1032 $ hg update default
1032 $ hg update default
1033 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1033 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1034 $ hg -y transplant -b foo tip
1034 $ hg -y transplant -b foo tip
1035 applying 4aa30d025d50
1035 applying 4aa30d025d50
1036 4aa30d025d50 transplanted to e00abbf63521
1036 4aa30d025d50 transplanted to e00abbf63521
1037
1037
1038 Expansion in changeset but not in file
1038 Expansion in changeset but not in file
1039
1039
1040 $ hg tip -p
1040 $ hg tip -p
1041 changeset: 11:e00abbf63521
1041 changeset: 11:e00abbf63521
1042 tag: tip
1042 tag: tip
1043 parent: 9:800511b3a22d
1043 parent: 9:800511b3a22d
1044 user: test
1044 user: test
1045 date: Thu Jan 01 00:00:00 1970 +0000
1045 date: Thu Jan 01 00:00:00 1970 +0000
1046 summary: 9foobranch
1046 summary: 9foobranch
1047
1047
1048 diff -r 800511b3a22d -r e00abbf63521 a
1048 diff -r 800511b3a22d -r e00abbf63521 a
1049 --- a/a Thu Jan 01 00:00:00 1970 +0000
1049 --- a/a Thu Jan 01 00:00:00 1970 +0000
1050 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1050 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1051 @@ -1,3 +1,4 @@
1051 @@ -1,3 +1,4 @@
1052 +foobranch
1052 +foobranch
1053 expand $Id$
1053 expand $Id$
1054 do not process $Id:
1054 do not process $Id:
1055 xxx $
1055 xxx $
1056
1056
1057 $ head -n 2 a
1057 $ head -n 2 a
1058 foobranch
1058 foobranch
1059 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1059 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1060
1060
1061 Turn off expansion
1061 Turn off expansion
1062
1062
1063 $ hg -q rollback
1063 $ hg -q rollback
1064 $ hg -q update -C
1064 $ hg -q update -C
1065
1065
1066 kwshrink with unknown file u
1066 kwshrink with unknown file u
1067
1067
1068 $ cp a u
1068 $ cp a u
1069 $ hg --verbose kwshrink
1069 $ hg --verbose kwshrink
1070 overwriting a shrinking keywords
1070 overwriting a shrinking keywords
1071 overwriting m shrinking keywords
1071 overwriting m shrinking keywords
1072 overwriting x/a shrinking keywords
1072 overwriting x/a shrinking keywords
1073
1073
1074 Keywords shrunk in working directory, but not yet disabled
1074 Keywords shrunk in working directory, but not yet disabled
1075 - cat shows unexpanded keywords
1075 - cat shows unexpanded keywords
1076 - hg cat shows expanded keywords
1076 - hg cat shows expanded keywords
1077
1077
1078 $ cat a b
1078 $ cat a b
1079 expand $Id$
1079 expand $Id$
1080 do not process $Id:
1080 do not process $Id:
1081 xxx $
1081 xxx $
1082 $Xinfo$
1082 $Xinfo$
1083 ignore $Id$
1083 ignore $Id$
1084 $ hg cat sym a b && echo
1084 $ hg cat sym a b && echo
1085 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1085 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1086 do not process $Id:
1086 do not process $Id:
1087 xxx $
1087 xxx $
1088 $Xinfo: User Name <user@example.com>: firstline $
1088 $Xinfo: User Name <user@example.com>: firstline $
1089 ignore $Id$
1089 ignore $Id$
1090 a
1090 a
1091
1091
1092 Now disable keyword expansion
1092 Now disable keyword expansion
1093
1093
1094 $ rm "$HGRCPATH"
1094 $ rm "$HGRCPATH"
1095 $ cat a b
1095 $ cat a b
1096 expand $Id$
1096 expand $Id$
1097 do not process $Id:
1097 do not process $Id:
1098 xxx $
1098 xxx $
1099 $Xinfo$
1099 $Xinfo$
1100 ignore $Id$
1100 ignore $Id$
1101 $ hg cat sym a b && echo
1101 $ hg cat sym a b && echo
1102 expand $Id$
1102 expand $Id$
1103 do not process $Id:
1103 do not process $Id:
1104 xxx $
1104 xxx $
1105 $Xinfo$
1105 $Xinfo$
1106 ignore $Id$
1106 ignore $Id$
1107 a
1107 a
@@ -1,348 +1,348 b''
1 Create configuration
1 Create configuration
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5
5
6 help qrefresh (no record)
6 help qrefresh (no record)
7
7
8 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "[extensions]" >> $HGRCPATH
9 $ echo "mq=" >> $HGRCPATH
9 $ echo "mq=" >> $HGRCPATH
10 $ hg help qrefresh
10 $ hg help qrefresh
11 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
11 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
12
12
13 update the current patch
13 update the current patch
14
14
15 If any file patterns are provided, the refreshed patch will contain only
15 If any file patterns are provided, the refreshed patch will contain only
16 the modifications that match those patterns; the remaining modifications
16 the modifications that match those patterns; the remaining modifications
17 will remain in the working directory.
17 will remain in the working directory.
18
18
19 If -s/--short is specified, files currently included in the patch will be
19 If -s/--short is specified, files currently included in the patch will be
20 refreshed just like matched files and remain in the patch.
20 refreshed just like matched files and remain in the patch.
21
21
22 If -e/--edit is specified, Mercurial will start your configured editor for
22 If -e/--edit is specified, Mercurial will start your configured editor for
23 you to enter a message. In case qrefresh fails, you will find a backup of
23 you to enter a message. In case qrefresh fails, you will find a backup of
24 your message in ".hg/last-message.txt".
24 your message in ".hg/last-message.txt".
25
25
26 hg add/remove/copy/rename work as usual, though you might want to use git-
26 hg add/remove/copy/rename work as usual, though you might want to use git-
27 style patches (-g/--git or [diff] git=1) to track copies and renames. See
27 style patches (-g/--git or [diff] git=1) to track copies and renames. See
28 the diffs help topic for more information on the git diff format.
28 the diffs help topic for more information on the git diff format.
29
29
30 Returns 0 on success.
30 Returns 0 on success.
31
31
32 options:
32 options:
33
33
34 -e --edit edit commit message
34 -e --edit edit commit message
35 -g --git use git extended diff format
35 -g --git use git extended diff format
36 -s --short refresh only files already in the patch and
36 -s --short refresh only files already in the patch and
37 specified files
37 specified files
38 -U --currentuser add/update author field in patch with current user
38 -U --currentuser add/update author field in patch with current user
39 -u --user USER add/update author field in patch with given user
39 -u --user USER add/update author field in patch with given user
40 -D --currentdate add/update date field in patch with current date
40 -D --currentdate add/update date field in patch with current date
41 -d --date DATE add/update date field in patch with given date
41 -d --date DATE add/update date field in patch with given date
42 -I --include PATTERN [+] include names matching the given patterns
42 -I --include PATTERN [+] include names matching the given patterns
43 -X --exclude PATTERN [+] exclude names matching the given patterns
43 -X --exclude PATTERN [+] exclude names matching the given patterns
44 -m --message TEXT use text as commit message
44 -m --message TEXT use text as commit message
45 -l --logfile FILE read commit message from file
45 -l --logfile FILE read commit message from file
46
46
47 [+] marked option can be specified multiple times
47 [+] marked option can be specified multiple times
48
48
49 use "hg -v help qrefresh" to show more info
49 use "hg -v help qrefresh" to show more info
50
50
51 help qrefresh (record)
51 help qrefresh (record)
52
52
53 $ echo "record=" >> $HGRCPATH
53 $ echo "record=" >> $HGRCPATH
54 $ hg help qrefresh
54 $ hg help qrefresh
55 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
55 hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
56
56
57 update the current patch
57 update the current patch
58
58
59 If any file patterns are provided, the refreshed patch will contain only
59 If any file patterns are provided, the refreshed patch will contain only
60 the modifications that match those patterns; the remaining modifications
60 the modifications that match those patterns; the remaining modifications
61 will remain in the working directory.
61 will remain in the working directory.
62
62
63 If -s/--short is specified, files currently included in the patch will be
63 If -s/--short is specified, files currently included in the patch will be
64 refreshed just like matched files and remain in the patch.
64 refreshed just like matched files and remain in the patch.
65
65
66 If -e/--edit is specified, Mercurial will start your configured editor for
66 If -e/--edit is specified, Mercurial will start your configured editor for
67 you to enter a message. In case qrefresh fails, you will find a backup of
67 you to enter a message. In case qrefresh fails, you will find a backup of
68 your message in ".hg/last-message.txt".
68 your message in ".hg/last-message.txt".
69
69
70 hg add/remove/copy/rename work as usual, though you might want to use git-
70 hg add/remove/copy/rename work as usual, though you might want to use git-
71 style patches (-g/--git or [diff] git=1) to track copies and renames. See
71 style patches (-g/--git or [diff] git=1) to track copies and renames. See
72 the diffs help topic for more information on the git diff format.
72 the diffs help topic for more information on the git diff format.
73
73
74 Returns 0 on success.
74 Returns 0 on success.
75
75
76 options:
76 options:
77
77
78 -e --edit edit commit message
78 -e --edit edit commit message
79 -g --git use git extended diff format
79 -g --git use git extended diff format
80 -s --short refresh only files already in the patch and
80 -s --short refresh only files already in the patch and
81 specified files
81 specified files
82 -U --currentuser add/update author field in patch with current user
82 -U --currentuser add/update author field in patch with current user
83 -u --user USER add/update author field in patch with given user
83 -u --user USER add/update author field in patch with given user
84 -D --currentdate add/update date field in patch with current date
84 -D --currentdate add/update date field in patch with current date
85 -d --date DATE add/update date field in patch with given date
85 -d --date DATE add/update date field in patch with given date
86 -I --include PATTERN [+] include names matching the given patterns
86 -I --include PATTERN [+] include names matching the given patterns
87 -X --exclude PATTERN [+] exclude names matching the given patterns
87 -X --exclude PATTERN [+] exclude names matching the given patterns
88 -m --message TEXT use text as commit message
88 -m --message TEXT use text as commit message
89 -l --logfile FILE read commit message from file
89 -l --logfile FILE read commit message from file
90 -i --interactive interactively select changes to refresh
90 -i --interactive interactively select changes to refresh
91
91
92 [+] marked option can be specified multiple times
92 [+] marked option can be specified multiple times
93
93
94 use "hg -v help qrefresh" to show more info
94 use "hg -v help qrefresh" to show more info
95
95
96 $ hg init a
96 $ hg init a
97 $ cd a
97 $ cd a
98
98
99 Base commit
99 Base commit
100
100
101 $ cat > 1.txt <<EOF
101 $ cat > 1.txt <<EOF
102 > 1
102 > 1
103 > 2
103 > 2
104 > 3
104 > 3
105 > 4
105 > 4
106 > 5
106 > 5
107 > EOF
107 > EOF
108 $ cat > 2.txt <<EOF
108 $ cat > 2.txt <<EOF
109 > a
109 > a
110 > b
110 > b
111 > c
111 > c
112 > d
112 > d
113 > e
113 > e
114 > f
114 > f
115 > EOF
115 > EOF
116
116
117 $ mkdir dir
117 $ mkdir dir
118 $ cat > dir/a.txt <<EOF
118 $ cat > dir/a.txt <<EOF
119 > hello world
119 > hello world
120 >
120 >
121 > someone
121 > someone
122 > up
122 > up
123 > there
123 > there
124 > loves
124 > loves
125 > me
125 > me
126 > EOF
126 > EOF
127
127
128 $ hg add 1.txt 2.txt dir/a.txt
128 $ hg add 1.txt 2.txt dir/a.txt
129 $ hg commit -m aaa
129 $ hg commit -m aaa
130 $ hg qnew -d '0 0' patch
130 $ hg qnew -d '0 0' patch
131
131
132 Changing files
132 Changing files
133
133
134 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
134 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
135 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
135 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
136 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
136 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
137
137
138 $ mv -f 1.txt.new 1.txt
138 $ mv -f 1.txt.new 1.txt
139 $ mv -f 2.txt.new 2.txt
139 $ mv -f 2.txt.new 2.txt
140 $ mv -f dir/a.txt.new dir/a.txt
140 $ mv -f dir/a.txt.new dir/a.txt
141
141
142 Whole diff
142 Whole diff
143
143
144 $ hg diff --nodates
144 $ hg diff --nodates
145 diff -r ed27675cb5df 1.txt
145 diff -r ed27675cb5df 1.txt
146 --- a/1.txt
146 --- a/1.txt
147 +++ b/1.txt
147 +++ b/1.txt
148 @@ -1,5 +1,5 @@
148 @@ -1,5 +1,5 @@
149 1
149 1
150 -2
150 -2
151 +2 2
151 +2 2
152 3
152 3
153 -4
153 -4
154 +4 4
154 +4 4
155 5
155 5
156 diff -r ed27675cb5df 2.txt
156 diff -r ed27675cb5df 2.txt
157 --- a/2.txt
157 --- a/2.txt
158 +++ b/2.txt
158 +++ b/2.txt
159 @@ -1,5 +1,5 @@
159 @@ -1,5 +1,5 @@
160 a
160 a
161 -b
161 -b
162 +b b
162 +b b
163 c
163 c
164 d
164 d
165 e
165 e
166 diff -r ed27675cb5df dir/a.txt
166 diff -r ed27675cb5df dir/a.txt
167 --- a/dir/a.txt
167 --- a/dir/a.txt
168 +++ b/dir/a.txt
168 +++ b/dir/a.txt
169 @@ -1,4 +1,4 @@
169 @@ -1,4 +1,4 @@
170 -hello world
170 -hello world
171 +hello world!
171 +hello world!
172
172
173 someone
173 someone
174 up
174 up
175
175
176 partial qrefresh
176 partial qrefresh
177
177
178 $ hg qrefresh -i -d '0 0' <<EOF
178 $ hg qrefresh -i -d '0 0' <<EOF
179 > y
179 > y
180 > y
180 > y
181 > n
181 > n
182 > y
182 > y
183 > y
183 > y
184 > n
184 > n
185 > EOF
185 > EOF
186 diff --git a/1.txt b/1.txt
186 diff --git a/1.txt b/1.txt
187 2 hunks, 2 lines changed
187 2 hunks, 2 lines changed
188 examine changes to '1.txt'? [Ynsfdaq?]
188 examine changes to '1.txt'? [Ynesfdaq?]
189 @@ -1,3 +1,3 @@
189 @@ -1,3 +1,3 @@
190 1
190 1
191 -2
191 -2
192 +2 2
192 +2 2
193 3
193 3
194 record change 1/4 to '1.txt'? [Ynsfdaq?]
194 record change 1/4 to '1.txt'? [Ynesfdaq?]
195 @@ -3,3 +3,3 @@
195 @@ -3,3 +3,3 @@
196 3
196 3
197 -4
197 -4
198 +4 4
198 +4 4
199 5
199 5
200 record change 2/4 to '1.txt'? [Ynsfdaq?]
200 record change 2/4 to '1.txt'? [Ynesfdaq?]
201 diff --git a/2.txt b/2.txt
201 diff --git a/2.txt b/2.txt
202 1 hunks, 1 lines changed
202 1 hunks, 1 lines changed
203 examine changes to '2.txt'? [Ynsfdaq?]
203 examine changes to '2.txt'? [Ynesfdaq?]
204 @@ -1,5 +1,5 @@
204 @@ -1,5 +1,5 @@
205 a
205 a
206 -b
206 -b
207 +b b
207 +b b
208 c
208 c
209 d
209 d
210 e
210 e
211 record change 3/4 to '2.txt'? [Ynsfdaq?]
211 record change 3/4 to '2.txt'? [Ynesfdaq?]
212 diff --git a/dir/a.txt b/dir/a.txt
212 diff --git a/dir/a.txt b/dir/a.txt
213 1 hunks, 1 lines changed
213 1 hunks, 1 lines changed
214 examine changes to 'dir/a.txt'? [Ynsfdaq?]
214 examine changes to 'dir/a.txt'? [Ynesfdaq?]
215
215
216 After partial qrefresh 'tip'
216 After partial qrefresh 'tip'
217
217
218 $ hg tip -p
218 $ hg tip -p
219 changeset: 1:0738af1a8211
219 changeset: 1:0738af1a8211
220 tag: patch
220 tag: patch
221 tag: qbase
221 tag: qbase
222 tag: qtip
222 tag: qtip
223 tag: tip
223 tag: tip
224 user: test
224 user: test
225 date: Thu Jan 01 00:00:00 1970 +0000
225 date: Thu Jan 01 00:00:00 1970 +0000
226 summary: [mq]: patch
226 summary: [mq]: patch
227
227
228 diff -r 1fd39ab63a33 -r 0738af1a8211 1.txt
228 diff -r 1fd39ab63a33 -r 0738af1a8211 1.txt
229 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
229 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
230 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
230 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
231 @@ -1,5 +1,5 @@
231 @@ -1,5 +1,5 @@
232 1
232 1
233 -2
233 -2
234 +2 2
234 +2 2
235 3
235 3
236 4
236 4
237 5
237 5
238 diff -r 1fd39ab63a33 -r 0738af1a8211 2.txt
238 diff -r 1fd39ab63a33 -r 0738af1a8211 2.txt
239 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
239 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
240 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
240 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
241 @@ -1,5 +1,5 @@
241 @@ -1,5 +1,5 @@
242 a
242 a
243 -b
243 -b
244 +b b
244 +b b
245 c
245 c
246 d
246 d
247 e
247 e
248
248
249 After partial qrefresh 'diff'
249 After partial qrefresh 'diff'
250
250
251 $ hg diff --nodates
251 $ hg diff --nodates
252 diff -r 0738af1a8211 1.txt
252 diff -r 0738af1a8211 1.txt
253 --- a/1.txt
253 --- a/1.txt
254 +++ b/1.txt
254 +++ b/1.txt
255 @@ -1,5 +1,5 @@
255 @@ -1,5 +1,5 @@
256 1
256 1
257 2 2
257 2 2
258 3
258 3
259 -4
259 -4
260 +4 4
260 +4 4
261 5
261 5
262 diff -r 0738af1a8211 dir/a.txt
262 diff -r 0738af1a8211 dir/a.txt
263 --- a/dir/a.txt
263 --- a/dir/a.txt
264 +++ b/dir/a.txt
264 +++ b/dir/a.txt
265 @@ -1,4 +1,4 @@
265 @@ -1,4 +1,4 @@
266 -hello world
266 -hello world
267 +hello world!
267 +hello world!
268
268
269 someone
269 someone
270 up
270 up
271
271
272 qrefresh interactively everything else
272 qrefresh interactively everything else
273
273
274 $ hg qrefresh -i -d '0 0' <<EOF
274 $ hg qrefresh -i -d '0 0' <<EOF
275 > y
275 > y
276 > y
276 > y
277 > y
277 > y
278 > y
278 > y
279 > EOF
279 > EOF
280 diff --git a/1.txt b/1.txt
280 diff --git a/1.txt b/1.txt
281 1 hunks, 1 lines changed
281 1 hunks, 1 lines changed
282 examine changes to '1.txt'? [Ynsfdaq?]
282 examine changes to '1.txt'? [Ynesfdaq?]
283 @@ -1,5 +1,5 @@
283 @@ -1,5 +1,5 @@
284 1
284 1
285 2 2
285 2 2
286 3
286 3
287 -4
287 -4
288 +4 4
288 +4 4
289 5
289 5
290 record change 1/2 to '1.txt'? [Ynsfdaq?]
290 record change 1/2 to '1.txt'? [Ynesfdaq?]
291 diff --git a/dir/a.txt b/dir/a.txt
291 diff --git a/dir/a.txt b/dir/a.txt
292 1 hunks, 1 lines changed
292 1 hunks, 1 lines changed
293 examine changes to 'dir/a.txt'? [Ynsfdaq?]
293 examine changes to 'dir/a.txt'? [Ynesfdaq?]
294 @@ -1,4 +1,4 @@
294 @@ -1,4 +1,4 @@
295 -hello world
295 -hello world
296 +hello world!
296 +hello world!
297
297
298 someone
298 someone
299 up
299 up
300 record change 2/2 to 'dir/a.txt'? [Ynsfdaq?]
300 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
301
301
302 After final qrefresh 'tip'
302 After final qrefresh 'tip'
303
303
304 $ hg tip -p
304 $ hg tip -p
305 changeset: 1:2c3f66afeed9
305 changeset: 1:2c3f66afeed9
306 tag: patch
306 tag: patch
307 tag: qbase
307 tag: qbase
308 tag: qtip
308 tag: qtip
309 tag: tip
309 tag: tip
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: [mq]: patch
312 summary: [mq]: patch
313
313
314 diff -r 1fd39ab63a33 -r 2c3f66afeed9 1.txt
314 diff -r 1fd39ab63a33 -r 2c3f66afeed9 1.txt
315 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
315 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
316 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
316 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
317 @@ -1,5 +1,5 @@
317 @@ -1,5 +1,5 @@
318 1
318 1
319 -2
319 -2
320 +2 2
320 +2 2
321 3
321 3
322 -4
322 -4
323 +4 4
323 +4 4
324 5
324 5
325 diff -r 1fd39ab63a33 -r 2c3f66afeed9 2.txt
325 diff -r 1fd39ab63a33 -r 2c3f66afeed9 2.txt
326 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
326 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
327 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
327 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
328 @@ -1,5 +1,5 @@
328 @@ -1,5 +1,5 @@
329 a
329 a
330 -b
330 -b
331 +b b
331 +b b
332 c
332 c
333 d
333 d
334 e
334 e
335 diff -r 1fd39ab63a33 -r 2c3f66afeed9 dir/a.txt
335 diff -r 1fd39ab63a33 -r 2c3f66afeed9 dir/a.txt
336 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
336 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
337 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
337 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
338 @@ -1,4 +1,4 @@
338 @@ -1,4 +1,4 @@
339 -hello world
339 -hello world
340 +hello world!
340 +hello world!
341
341
342 someone
342 someone
343 up
343 up
344
344
345
345
346 After qrefresh 'diff'
346 After qrefresh 'diff'
347
347
348 $ hg diff --nodates
348 $ hg diff --nodates
@@ -1,355 +1,355 b''
1 $ echo "[ui]" >> $HGRCPATH
1 $ echo "[ui]" >> $HGRCPATH
2 $ echo "commitsubrepos = Yes" >> $HGRCPATH
2 $ echo "commitsubrepos = Yes" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ echo "record=" >> $HGRCPATH
5 $ echo "record=" >> $HGRCPATH
6 $ echo "[diff]" >> $HGRCPATH
6 $ echo "[diff]" >> $HGRCPATH
7 $ echo "nodates=1" >> $HGRCPATH
7 $ echo "nodates=1" >> $HGRCPATH
8
8
9 $ stdin=`pwd`/stdin.tmp
9 $ stdin=`pwd`/stdin.tmp
10
10
11 fn to create new repository w/dirty subrepo, and cd into it
11 fn to create new repository w/dirty subrepo, and cd into it
12 $ mkrepo() {
12 $ mkrepo() {
13 > hg init $1
13 > hg init $1
14 > cd $1
14 > cd $1
15 > hg qinit
15 > hg qinit
16 > }
16 > }
17
17
18 fn to create dirty subrepo
18 fn to create dirty subrepo
19 $ mksubrepo() {
19 $ mksubrepo() {
20 > hg init $1
20 > hg init $1
21 > cd $1
21 > cd $1
22 > echo a > a
22 > echo a > a
23 > hg add
23 > hg add
24 > cd ..
24 > cd ..
25 > }
25 > }
26
26
27 $ testadd() {
27 $ testadd() {
28 > cat - > "$stdin"
28 > cat - > "$stdin"
29 > mksubrepo sub
29 > mksubrepo sub
30 > echo sub = sub >> .hgsub
30 > echo sub = sub >> .hgsub
31 > hg add .hgsub
31 > hg add .hgsub
32 > echo % abort when adding .hgsub w/dirty subrepo
32 > echo % abort when adding .hgsub w/dirty subrepo
33 > hg status -S
33 > hg status -S
34 > echo '%' $*
34 > echo '%' $*
35 > cat "$stdin" | hg $*
35 > cat "$stdin" | hg $*
36 > echo [$?]
36 > echo [$?]
37 > hg -R sub ci -m0sub
37 > hg -R sub ci -m0sub
38 > echo % update substate when adding .hgsub w/clean updated subrepo
38 > echo % update substate when adding .hgsub w/clean updated subrepo
39 > hg status -S
39 > hg status -S
40 > echo '%' $*
40 > echo '%' $*
41 > cat "$stdin" | hg $*
41 > cat "$stdin" | hg $*
42 > hg debugsub
42 > hg debugsub
43 > }
43 > }
44
44
45 $ testmod() {
45 $ testmod() {
46 > cat - > "$stdin"
46 > cat - > "$stdin"
47 > mksubrepo sub2
47 > mksubrepo sub2
48 > echo sub2 = sub2 >> .hgsub
48 > echo sub2 = sub2 >> .hgsub
49 > echo % abort when modifying .hgsub w/dirty subrepo
49 > echo % abort when modifying .hgsub w/dirty subrepo
50 > hg status -S
50 > hg status -S
51 > echo '%' $*
51 > echo '%' $*
52 > cat "$stdin" | hg $*
52 > cat "$stdin" | hg $*
53 > echo [$?]
53 > echo [$?]
54 > hg -R sub2 ci -m0sub2
54 > hg -R sub2 ci -m0sub2
55 > echo % update substate when modifying .hgsub w/clean updated subrepo
55 > echo % update substate when modifying .hgsub w/clean updated subrepo
56 > hg status -S
56 > hg status -S
57 > echo '%' $*
57 > echo '%' $*
58 > cat "$stdin" | hg $*
58 > cat "$stdin" | hg $*
59 > hg debugsub
59 > hg debugsub
60 > }
60 > }
61
61
62 $ testrm1() {
62 $ testrm1() {
63 > cat - > "$stdin"
63 > cat - > "$stdin"
64 > mksubrepo sub3
64 > mksubrepo sub3
65 > echo sub3 = sub3 >> .hgsub
65 > echo sub3 = sub3 >> .hgsub
66 > hg ci -Aqmsub3
66 > hg ci -Aqmsub3
67 > $EXTRA
67 > $EXTRA
68 > echo b >> sub3/a
68 > echo b >> sub3/a
69 > hg rm .hgsub
69 > hg rm .hgsub
70 > echo % update substate when removing .hgsub w/dirty subrepo
70 > echo % update substate when removing .hgsub w/dirty subrepo
71 > hg status -S
71 > hg status -S
72 > echo '%' $*
72 > echo '%' $*
73 > cat "$stdin" | hg $*
73 > cat "$stdin" | hg $*
74 > echo % debugsub should be empty
74 > echo % debugsub should be empty
75 > hg debugsub
75 > hg debugsub
76 > }
76 > }
77
77
78 $ testrm2() {
78 $ testrm2() {
79 > cat - > "$stdin"
79 > cat - > "$stdin"
80 > mksubrepo sub4
80 > mksubrepo sub4
81 > echo sub4 = sub4 >> .hgsub
81 > echo sub4 = sub4 >> .hgsub
82 > hg ci -Aqmsub4
82 > hg ci -Aqmsub4
83 > $EXTRA
83 > $EXTRA
84 > hg rm .hgsub
84 > hg rm .hgsub
85 > echo % update substate when removing .hgsub w/clean updated subrepo
85 > echo % update substate when removing .hgsub w/clean updated subrepo
86 > hg status -S
86 > hg status -S
87 > echo '%' $*
87 > echo '%' $*
88 > cat "$stdin" | hg $*
88 > cat "$stdin" | hg $*
89 > echo % debugsub should be empty
89 > echo % debugsub should be empty
90 > hg debugsub
90 > hg debugsub
91 > }
91 > }
92
92
93
93
94 handle subrepos safely on qnew
94 handle subrepos safely on qnew
95
95
96 $ mkrepo repo-2499-qnew
96 $ mkrepo repo-2499-qnew
97 $ testadd qnew -m0 0.diff
97 $ testadd qnew -m0 0.diff
98 adding a
98 adding a
99 % abort when adding .hgsub w/dirty subrepo
99 % abort when adding .hgsub w/dirty subrepo
100 A .hgsub
100 A .hgsub
101 A sub/a
101 A sub/a
102 % qnew -m0 0.diff
102 % qnew -m0 0.diff
103 abort: uncommitted changes in subrepository sub
103 abort: uncommitted changes in subrepository sub
104 [255]
104 [255]
105 % update substate when adding .hgsub w/clean updated subrepo
105 % update substate when adding .hgsub w/clean updated subrepo
106 A .hgsub
106 A .hgsub
107 % qnew -m0 0.diff
107 % qnew -m0 0.diff
108 path sub
108 path sub
109 source sub
109 source sub
110 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
110 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
111
111
112 $ testmod qnew -m1 1.diff
112 $ testmod qnew -m1 1.diff
113 adding a
113 adding a
114 % abort when modifying .hgsub w/dirty subrepo
114 % abort when modifying .hgsub w/dirty subrepo
115 M .hgsub
115 M .hgsub
116 A sub2/a
116 A sub2/a
117 % qnew -m1 1.diff
117 % qnew -m1 1.diff
118 abort: uncommitted changes in subrepository sub2
118 abort: uncommitted changes in subrepository sub2
119 [255]
119 [255]
120 % update substate when modifying .hgsub w/clean updated subrepo
120 % update substate when modifying .hgsub w/clean updated subrepo
121 M .hgsub
121 M .hgsub
122 % qnew -m1 1.diff
122 % qnew -m1 1.diff
123 path sub
123 path sub
124 source sub
124 source sub
125 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
125 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
126 path sub2
126 path sub2
127 source sub2
127 source sub2
128 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
128 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
129
129
130 $ hg qpop -qa
130 $ hg qpop -qa
131 patch queue now empty
131 patch queue now empty
132 $ testrm1 qnew -m2 2.diff
132 $ testrm1 qnew -m2 2.diff
133 adding a
133 adding a
134 % update substate when removing .hgsub w/dirty subrepo
134 % update substate when removing .hgsub w/dirty subrepo
135 M sub3/a
135 M sub3/a
136 R .hgsub
136 R .hgsub
137 % qnew -m2 2.diff
137 % qnew -m2 2.diff
138 % debugsub should be empty
138 % debugsub should be empty
139
139
140 $ hg qpop -qa
140 $ hg qpop -qa
141 patch queue now empty
141 patch queue now empty
142 $ testrm2 qnew -m3 3.diff
142 $ testrm2 qnew -m3 3.diff
143 adding a
143 adding a
144 % update substate when removing .hgsub w/clean updated subrepo
144 % update substate when removing .hgsub w/clean updated subrepo
145 R .hgsub
145 R .hgsub
146 % qnew -m3 3.diff
146 % qnew -m3 3.diff
147 % debugsub should be empty
147 % debugsub should be empty
148
148
149 $ cd ..
149 $ cd ..
150
150
151
151
152 handle subrepos safely on qrefresh
152 handle subrepos safely on qrefresh
153
153
154 $ mkrepo repo-2499-qrefresh
154 $ mkrepo repo-2499-qrefresh
155 $ hg qnew -m0 0.diff
155 $ hg qnew -m0 0.diff
156 $ testadd qrefresh
156 $ testadd qrefresh
157 adding a
157 adding a
158 % abort when adding .hgsub w/dirty subrepo
158 % abort when adding .hgsub w/dirty subrepo
159 A .hgsub
159 A .hgsub
160 A sub/a
160 A sub/a
161 % qrefresh
161 % qrefresh
162 abort: uncommitted changes in subrepository sub
162 abort: uncommitted changes in subrepository sub
163 [255]
163 [255]
164 % update substate when adding .hgsub w/clean updated subrepo
164 % update substate when adding .hgsub w/clean updated subrepo
165 A .hgsub
165 A .hgsub
166 % qrefresh
166 % qrefresh
167 path sub
167 path sub
168 source sub
168 source sub
169 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
169 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
170
170
171 $ hg qnew -m1 1.diff
171 $ hg qnew -m1 1.diff
172 $ testmod qrefresh
172 $ testmod qrefresh
173 adding a
173 adding a
174 % abort when modifying .hgsub w/dirty subrepo
174 % abort when modifying .hgsub w/dirty subrepo
175 M .hgsub
175 M .hgsub
176 A sub2/a
176 A sub2/a
177 % qrefresh
177 % qrefresh
178 abort: uncommitted changes in subrepository sub2
178 abort: uncommitted changes in subrepository sub2
179 [255]
179 [255]
180 % update substate when modifying .hgsub w/clean updated subrepo
180 % update substate when modifying .hgsub w/clean updated subrepo
181 M .hgsub
181 M .hgsub
182 % qrefresh
182 % qrefresh
183 path sub
183 path sub
184 source sub
184 source sub
185 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
185 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
186 path sub2
186 path sub2
187 source sub2
187 source sub2
188 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
188 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
189
189
190 $ hg qpop -qa
190 $ hg qpop -qa
191 patch queue now empty
191 patch queue now empty
192 $ EXTRA='hg qnew -m2 2.diff'
192 $ EXTRA='hg qnew -m2 2.diff'
193 $ testrm1 qrefresh
193 $ testrm1 qrefresh
194 adding a
194 adding a
195 % update substate when removing .hgsub w/dirty subrepo
195 % update substate when removing .hgsub w/dirty subrepo
196 M sub3/a
196 M sub3/a
197 R .hgsub
197 R .hgsub
198 % qrefresh
198 % qrefresh
199 % debugsub should be empty
199 % debugsub should be empty
200
200
201 $ hg qpop -qa
201 $ hg qpop -qa
202 patch queue now empty
202 patch queue now empty
203 $ EXTRA='hg qnew -m3 3.diff'
203 $ EXTRA='hg qnew -m3 3.diff'
204 $ testrm2 qrefresh
204 $ testrm2 qrefresh
205 adding a
205 adding a
206 % update substate when removing .hgsub w/clean updated subrepo
206 % update substate when removing .hgsub w/clean updated subrepo
207 R .hgsub
207 R .hgsub
208 % qrefresh
208 % qrefresh
209 % debugsub should be empty
209 % debugsub should be empty
210 $ EXTRA=
210 $ EXTRA=
211
211
212 $ cd ..
212 $ cd ..
213
213
214
214
215 handle subrepos safely on qpush/qpop
215 handle subrepos safely on qpush/qpop
216
216
217 $ mkrepo repo-2499-qpush
217 $ mkrepo repo-2499-qpush
218 $ mksubrepo sub
218 $ mksubrepo sub
219 adding a
219 adding a
220 $ hg -R sub ci -m0sub
220 $ hg -R sub ci -m0sub
221 $ echo sub = sub > .hgsub
221 $ echo sub = sub > .hgsub
222 $ hg add .hgsub
222 $ hg add .hgsub
223 $ hg qnew -m0 0.diff
223 $ hg qnew -m0 0.diff
224 $ hg debugsub
224 $ hg debugsub
225 path sub
225 path sub
226 source sub
226 source sub
227 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
227 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
228
228
229 qpop
229 qpop
230 $ hg qpop
230 $ hg qpop
231 popping 0.diff
231 popping 0.diff
232 patch queue now empty
232 patch queue now empty
233 $ hg status -AS
233 $ hg status -AS
234 $ hg debugsub
234 $ hg debugsub
235
235
236 qpush
236 qpush
237 $ hg qpush
237 $ hg qpush
238 applying 0.diff
238 applying 0.diff
239 now at: 0.diff
239 now at: 0.diff
240 $ hg status -AS
240 $ hg status -AS
241 C .hgsub
241 C .hgsub
242 C .hgsubstate
242 C .hgsubstate
243 C sub/a
243 C sub/a
244 $ hg debugsub
244 $ hg debugsub
245 path sub
245 path sub
246 source sub
246 source sub
247 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
247 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
248
248
249 $ cd ..
249 $ cd ..
250
250
251
251
252 handle subrepos safely on qrecord
252 handle subrepos safely on qrecord
253
253
254 $ mkrepo repo-2499-qrecord
254 $ mkrepo repo-2499-qrecord
255 $ testadd qrecord --config ui.interactive=1 -m0 0.diff <<EOF
255 $ testadd qrecord --config ui.interactive=1 -m0 0.diff <<EOF
256 > y
256 > y
257 > y
257 > y
258 > EOF
258 > EOF
259 adding a
259 adding a
260 % abort when adding .hgsub w/dirty subrepo
260 % abort when adding .hgsub w/dirty subrepo
261 A .hgsub
261 A .hgsub
262 A sub/a
262 A sub/a
263 % qrecord --config ui.interactive=1 -m0 0.diff
263 % qrecord --config ui.interactive=1 -m0 0.diff
264 diff --git a/.hgsub b/.hgsub
264 diff --git a/.hgsub b/.hgsub
265 new file mode 100644
265 new file mode 100644
266 examine changes to '.hgsub'? [Ynsfdaq?]
266 examine changes to '.hgsub'? [Ynesfdaq?]
267 abort: uncommitted changes in subrepository sub
267 abort: uncommitted changes in subrepository sub
268 [255]
268 [255]
269 % update substate when adding .hgsub w/clean updated subrepo
269 % update substate when adding .hgsub w/clean updated subrepo
270 A .hgsub
270 A .hgsub
271 % qrecord --config ui.interactive=1 -m0 0.diff
271 % qrecord --config ui.interactive=1 -m0 0.diff
272 diff --git a/.hgsub b/.hgsub
272 diff --git a/.hgsub b/.hgsub
273 new file mode 100644
273 new file mode 100644
274 examine changes to '.hgsub'? [Ynsfdaq?]
274 examine changes to '.hgsub'? [Ynesfdaq?]
275 path sub
275 path sub
276 source sub
276 source sub
277 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
277 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
278
278
279 $ testmod qrecord --config ui.interactive=1 -m1 1.diff <<EOF
279 $ testmod qrecord --config ui.interactive=1 -m1 1.diff <<EOF
280 > y
280 > y
281 > y
281 > y
282 > EOF
282 > EOF
283 adding a
283 adding a
284 % abort when modifying .hgsub w/dirty subrepo
284 % abort when modifying .hgsub w/dirty subrepo
285 M .hgsub
285 M .hgsub
286 A sub2/a
286 A sub2/a
287 % qrecord --config ui.interactive=1 -m1 1.diff
287 % qrecord --config ui.interactive=1 -m1 1.diff
288 diff --git a/.hgsub b/.hgsub
288 diff --git a/.hgsub b/.hgsub
289 1 hunks, 1 lines changed
289 1 hunks, 1 lines changed
290 examine changes to '.hgsub'? [Ynsfdaq?]
290 examine changes to '.hgsub'? [Ynesfdaq?]
291 @@ -1,1 +1,2 @@
291 @@ -1,1 +1,2 @@
292 sub = sub
292 sub = sub
293 +sub2 = sub2
293 +sub2 = sub2
294 record this change to '.hgsub'? [Ynsfdaq?]
294 record this change to '.hgsub'? [Ynesfdaq?]
295 abort: uncommitted changes in subrepository sub2
295 abort: uncommitted changes in subrepository sub2
296 [255]
296 [255]
297 % update substate when modifying .hgsub w/clean updated subrepo
297 % update substate when modifying .hgsub w/clean updated subrepo
298 M .hgsub
298 M .hgsub
299 % qrecord --config ui.interactive=1 -m1 1.diff
299 % qrecord --config ui.interactive=1 -m1 1.diff
300 diff --git a/.hgsub b/.hgsub
300 diff --git a/.hgsub b/.hgsub
301 1 hunks, 1 lines changed
301 1 hunks, 1 lines changed
302 examine changes to '.hgsub'? [Ynsfdaq?]
302 examine changes to '.hgsub'? [Ynesfdaq?]
303 @@ -1,1 +1,2 @@
303 @@ -1,1 +1,2 @@
304 sub = sub
304 sub = sub
305 +sub2 = sub2
305 +sub2 = sub2
306 record this change to '.hgsub'? [Ynsfdaq?]
306 record this change to '.hgsub'? [Ynesfdaq?]
307 path sub
307 path sub
308 source sub
308 source sub
309 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
309 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
310 path sub2
310 path sub2
311 source sub2
311 source sub2
312 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
312 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
313
313
314 $ hg qpop -qa
314 $ hg qpop -qa
315 patch queue now empty
315 patch queue now empty
316 $ testrm1 qrecord --config ui.interactive=1 -m2 2.diff <<EOF
316 $ testrm1 qrecord --config ui.interactive=1 -m2 2.diff <<EOF
317 > y
317 > y
318 > y
318 > y
319 > EOF
319 > EOF
320 adding a
320 adding a
321 % update substate when removing .hgsub w/dirty subrepo
321 % update substate when removing .hgsub w/dirty subrepo
322 M sub3/a
322 M sub3/a
323 R .hgsub
323 R .hgsub
324 % qrecord --config ui.interactive=1 -m2 2.diff
324 % qrecord --config ui.interactive=1 -m2 2.diff
325 diff --git a/.hgsub b/.hgsub
325 diff --git a/.hgsub b/.hgsub
326 deleted file mode 100644
326 deleted file mode 100644
327 examine changes to '.hgsub'? [Ynsfdaq?]
327 examine changes to '.hgsub'? [Ynesfdaq?]
328 % debugsub should be empty
328 % debugsub should be empty
329
329
330 $ hg qpop -qa
330 $ hg qpop -qa
331 patch queue now empty
331 patch queue now empty
332 $ testrm2 qrecord --config ui.interactive=1 -m3 3.diff <<EOF
332 $ testrm2 qrecord --config ui.interactive=1 -m3 3.diff <<EOF
333 > y
333 > y
334 > y
334 > y
335 > EOF
335 > EOF
336 adding a
336 adding a
337 % update substate when removing .hgsub w/clean updated subrepo
337 % update substate when removing .hgsub w/clean updated subrepo
338 R .hgsub
338 R .hgsub
339 % qrecord --config ui.interactive=1 -m3 3.diff
339 % qrecord --config ui.interactive=1 -m3 3.diff
340 diff --git a/.hgsub b/.hgsub
340 diff --git a/.hgsub b/.hgsub
341 deleted file mode 100644
341 deleted file mode 100644
342 examine changes to '.hgsub'? [Ynsfdaq?]
342 examine changes to '.hgsub'? [Ynesfdaq?]
343 % debugsub should be empty
343 % debugsub should be empty
344
344
345 $ cd ..
345 $ cd ..
346
346
347
347
348 correctly handle subrepos with patch queues
348 correctly handle subrepos with patch queues
349 $ mkrepo repo-subrepo-with-queue
349 $ mkrepo repo-subrepo-with-queue
350 $ mksubrepo sub
350 $ mksubrepo sub
351 adding a
351 adding a
352 $ hg -R sub qnew sub0.diff
352 $ hg -R sub qnew sub0.diff
353 $ echo sub = sub >> .hgsub
353 $ echo sub = sub >> .hgsub
354 $ hg add .hgsub
354 $ hg add .hgsub
355 $ hg qnew 0.diff
355 $ hg qnew 0.diff
@@ -1,397 +1,398 b''
1 Create configuration
1 Create configuration
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5
5
6 help record (no record)
6 help record (no record)
7
7
8 $ hg help record
8 $ hg help record
9 record extension - commands to interactively select changes for commit/qrefresh
9 record extension - commands to interactively select changes for commit/qrefresh
10
10
11 use "hg help extensions" for information on enabling extensions
11 use "hg help extensions" for information on enabling extensions
12
12
13 help qrecord (no record)
13 help qrecord (no record)
14
14
15 $ hg help qrecord
15 $ hg help qrecord
16 'qrecord' is provided by the following extension:
16 'qrecord' is provided by the following extension:
17
17
18 record commands to interactively select changes for commit/qrefresh
18 record commands to interactively select changes for commit/qrefresh
19
19
20 use "hg help extensions" for information on enabling extensions
20 use "hg help extensions" for information on enabling extensions
21
21
22 $ echo "[extensions]" >> $HGRCPATH
22 $ echo "[extensions]" >> $HGRCPATH
23 $ echo "record=" >> $HGRCPATH
23 $ echo "record=" >> $HGRCPATH
24
24
25 help record (record)
25 help record (record)
26
26
27 $ hg help record
27 $ hg help record
28 hg record [OPTION]... [FILE]...
28 hg record [OPTION]... [FILE]...
29
29
30 interactively select changes to commit
30 interactively select changes to commit
31
31
32 If a list of files is omitted, all changes reported by "hg status" will be
32 If a list of files is omitted, all changes reported by "hg status" will be
33 candidates for recording.
33 candidates for recording.
34
34
35 See "hg help dates" for a list of formats valid for -d/--date.
35 See "hg help dates" for a list of formats valid for -d/--date.
36
36
37 You will be prompted for whether to record changes to each modified file,
37 You will be prompted for whether to record changes to each modified file,
38 and for files with multiple changes, for each change to use. For each
38 and for files with multiple changes, for each change to use. For each
39 query, the following responses are possible:
39 query, the following responses are possible:
40
40
41 y - record this change
41 y - record this change
42 n - skip this change
42 n - skip this change
43 e - edit this change manually
43
44
44 s - skip remaining changes to this file
45 s - skip remaining changes to this file
45 f - record remaining changes to this file
46 f - record remaining changes to this file
46
47
47 d - done, skip remaining changes and files
48 d - done, skip remaining changes and files
48 a - record all changes to all remaining files
49 a - record all changes to all remaining files
49 q - quit, recording no changes
50 q - quit, recording no changes
50
51
51 ? - display help
52 ? - display help
52
53
53 This command is not available when committing a merge.
54 This command is not available when committing a merge.
54
55
55 options:
56 options:
56
57
57 -A --addremove mark new/missing files as added/removed before
58 -A --addremove mark new/missing files as added/removed before
58 committing
59 committing
59 --close-branch mark a branch as closed, hiding it from the branch
60 --close-branch mark a branch as closed, hiding it from the branch
60 list
61 list
61 -I --include PATTERN [+] include names matching the given patterns
62 -I --include PATTERN [+] include names matching the given patterns
62 -X --exclude PATTERN [+] exclude names matching the given patterns
63 -X --exclude PATTERN [+] exclude names matching the given patterns
63 -m --message TEXT use text as commit message
64 -m --message TEXT use text as commit message
64 -l --logfile FILE read commit message from file
65 -l --logfile FILE read commit message from file
65 -d --date DATE record the specified date as commit date
66 -d --date DATE record the specified date as commit date
66 -u --user USER record the specified user as committer
67 -u --user USER record the specified user as committer
67 -S --subrepos recurse into subrepositories
68 -S --subrepos recurse into subrepositories
68 -w --ignore-all-space ignore white space when comparing lines
69 -w --ignore-all-space ignore white space when comparing lines
69 -b --ignore-space-change ignore changes in the amount of white space
70 -b --ignore-space-change ignore changes in the amount of white space
70 -B --ignore-blank-lines ignore changes whose lines are all blank
71 -B --ignore-blank-lines ignore changes whose lines are all blank
71
72
72 [+] marked option can be specified multiple times
73 [+] marked option can be specified multiple times
73
74
74 use "hg -v help record" to show more info
75 use "hg -v help record" to show more info
75
76
76 help (no mq, so no qrecord)
77 help (no mq, so no qrecord)
77
78
78 $ hg help qrecord
79 $ hg help qrecord
79 hg qrecord [OPTION]... PATCH [FILE]...
80 hg qrecord [OPTION]... PATCH [FILE]...
80
81
81 interactively record a new patch
82 interactively record a new patch
82
83
83 See "hg help qnew" & "hg help record" for more information and usage.
84 See "hg help qnew" & "hg help record" for more information and usage.
84
85
85 use "hg -v help qrecord" to show more info
86 use "hg -v help qrecord" to show more info
86
87
87 $ hg init a
88 $ hg init a
88
89
89 qrecord (mq not present)
90 qrecord (mq not present)
90
91
91 $ hg -R a qrecord
92 $ hg -R a qrecord
92 hg qrecord: invalid arguments
93 hg qrecord: invalid arguments
93 hg qrecord [OPTION]... PATCH [FILE]...
94 hg qrecord [OPTION]... PATCH [FILE]...
94
95
95 interactively record a new patch
96 interactively record a new patch
96
97
97 use "hg help qrecord" to show the full help text
98 use "hg help qrecord" to show the full help text
98 [255]
99 [255]
99
100
100 qrecord patch (mq not present)
101 qrecord patch (mq not present)
101
102
102 $ hg -R a qrecord patch
103 $ hg -R a qrecord patch
103 abort: 'mq' extension not loaded
104 abort: 'mq' extension not loaded
104 [255]
105 [255]
105
106
106 help (bad mq)
107 help (bad mq)
107
108
108 $ echo "mq=nonexistant" >> $HGRCPATH
109 $ echo "mq=nonexistant" >> $HGRCPATH
109 $ hg help qrecord
110 $ hg help qrecord
110 *** failed to import extension mq from nonexistant: [Errno 2] * (glob)
111 *** failed to import extension mq from nonexistant: [Errno 2] * (glob)
111 hg qrecord [OPTION]... PATCH [FILE]...
112 hg qrecord [OPTION]... PATCH [FILE]...
112
113
113 interactively record a new patch
114 interactively record a new patch
114
115
115 See "hg help qnew" & "hg help record" for more information and usage.
116 See "hg help qnew" & "hg help record" for more information and usage.
116
117
117 use "hg -v help qrecord" to show more info
118 use "hg -v help qrecord" to show more info
118
119
119 help (mq present)
120 help (mq present)
120
121
121 $ sed 's/mq=nonexistant/mq=/' $HGRCPATH > hgrc.tmp
122 $ sed 's/mq=nonexistant/mq=/' $HGRCPATH > hgrc.tmp
122 $ mv hgrc.tmp $HGRCPATH
123 $ mv hgrc.tmp $HGRCPATH
123
124
124 $ hg help qrecord
125 $ hg help qrecord
125 hg qrecord [OPTION]... PATCH [FILE]...
126 hg qrecord [OPTION]... PATCH [FILE]...
126
127
127 interactively record a new patch
128 interactively record a new patch
128
129
129 See "hg help qnew" & "hg help record" for more information and usage.
130 See "hg help qnew" & "hg help record" for more information and usage.
130
131
131 options:
132 options:
132
133
133 -e --edit edit commit message
134 -e --edit edit commit message
134 -g --git use git extended diff format
135 -g --git use git extended diff format
135 -U --currentuser add "From: <current user>" to patch
136 -U --currentuser add "From: <current user>" to patch
136 -u --user USER add "From: <USER>" to patch
137 -u --user USER add "From: <USER>" to patch
137 -D --currentdate add "Date: <current date>" to patch
138 -D --currentdate add "Date: <current date>" to patch
138 -d --date DATE add "Date: <DATE>" to patch
139 -d --date DATE add "Date: <DATE>" to patch
139 -I --include PATTERN [+] include names matching the given patterns
140 -I --include PATTERN [+] include names matching the given patterns
140 -X --exclude PATTERN [+] exclude names matching the given patterns
141 -X --exclude PATTERN [+] exclude names matching the given patterns
141 -m --message TEXT use text as commit message
142 -m --message TEXT use text as commit message
142 -l --logfile FILE read commit message from file
143 -l --logfile FILE read commit message from file
143 -w --ignore-all-space ignore white space when comparing lines
144 -w --ignore-all-space ignore white space when comparing lines
144 -b --ignore-space-change ignore changes in the amount of white space
145 -b --ignore-space-change ignore changes in the amount of white space
145 -B --ignore-blank-lines ignore changes whose lines are all blank
146 -B --ignore-blank-lines ignore changes whose lines are all blank
146 --mq operate on patch repository
147 --mq operate on patch repository
147
148
148 [+] marked option can be specified multiple times
149 [+] marked option can be specified multiple times
149
150
150 use "hg -v help qrecord" to show more info
151 use "hg -v help qrecord" to show more info
151
152
152 $ cd a
153 $ cd a
153
154
154 Base commit
155 Base commit
155
156
156 $ cat > 1.txt <<EOF
157 $ cat > 1.txt <<EOF
157 > 1
158 > 1
158 > 2
159 > 2
159 > 3
160 > 3
160 > 4
161 > 4
161 > 5
162 > 5
162 > EOF
163 > EOF
163 $ cat > 2.txt <<EOF
164 $ cat > 2.txt <<EOF
164 > a
165 > a
165 > b
166 > b
166 > c
167 > c
167 > d
168 > d
168 > e
169 > e
169 > f
170 > f
170 > EOF
171 > EOF
171
172
172 $ mkdir dir
173 $ mkdir dir
173 $ cat > dir/a.txt <<EOF
174 $ cat > dir/a.txt <<EOF
174 > hello world
175 > hello world
175 >
176 >
176 > someone
177 > someone
177 > up
178 > up
178 > there
179 > there
179 > loves
180 > loves
180 > me
181 > me
181 > EOF
182 > EOF
182
183
183 $ hg add 1.txt 2.txt dir/a.txt
184 $ hg add 1.txt 2.txt dir/a.txt
184 $ hg commit -m 'initial checkin'
185 $ hg commit -m 'initial checkin'
185
186
186 Changing files
187 Changing files
187
188
188 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
189 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
189 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
190 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
190 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
191 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
191
192
192 $ mv -f 1.txt.new 1.txt
193 $ mv -f 1.txt.new 1.txt
193 $ mv -f 2.txt.new 2.txt
194 $ mv -f 2.txt.new 2.txt
194 $ mv -f dir/a.txt.new dir/a.txt
195 $ mv -f dir/a.txt.new dir/a.txt
195
196
196 Whole diff
197 Whole diff
197
198
198 $ hg diff --nodates
199 $ hg diff --nodates
199 diff -r 1057167b20ef 1.txt
200 diff -r 1057167b20ef 1.txt
200 --- a/1.txt
201 --- a/1.txt
201 +++ b/1.txt
202 +++ b/1.txt
202 @@ -1,5 +1,5 @@
203 @@ -1,5 +1,5 @@
203 1
204 1
204 -2
205 -2
205 +2 2
206 +2 2
206 3
207 3
207 -4
208 -4
208 +4 4
209 +4 4
209 5
210 5
210 diff -r 1057167b20ef 2.txt
211 diff -r 1057167b20ef 2.txt
211 --- a/2.txt
212 --- a/2.txt
212 +++ b/2.txt
213 +++ b/2.txt
213 @@ -1,5 +1,5 @@
214 @@ -1,5 +1,5 @@
214 a
215 a
215 -b
216 -b
216 +b b
217 +b b
217 c
218 c
218 d
219 d
219 e
220 e
220 diff -r 1057167b20ef dir/a.txt
221 diff -r 1057167b20ef dir/a.txt
221 --- a/dir/a.txt
222 --- a/dir/a.txt
222 +++ b/dir/a.txt
223 +++ b/dir/a.txt
223 @@ -1,4 +1,4 @@
224 @@ -1,4 +1,4 @@
224 -hello world
225 -hello world
225 +hello world!
226 +hello world!
226
227
227 someone
228 someone
228 up
229 up
229
230
230 qrecord with bad patch name, should abort before prompting
231 qrecord with bad patch name, should abort before prompting
231
232
232 $ hg qrecord .hg
233 $ hg qrecord .hg
233 abort: patch name cannot begin with ".hg"
234 abort: patch name cannot begin with ".hg"
234 [255]
235 [255]
235
236
236 qrecord a.patch
237 qrecord a.patch
237
238
238 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
239 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
239 > y
240 > y
240 > y
241 > y
241 > n
242 > n
242 > y
243 > y
243 > y
244 > y
244 > n
245 > n
245 > EOF
246 > EOF
246 diff --git a/1.txt b/1.txt
247 diff --git a/1.txt b/1.txt
247 2 hunks, 2 lines changed
248 2 hunks, 2 lines changed
248 examine changes to '1.txt'? [Ynsfdaq?]
249 examine changes to '1.txt'? [Ynesfdaq?]
249 @@ -1,3 +1,3 @@
250 @@ -1,3 +1,3 @@
250 1
251 1
251 -2
252 -2
252 +2 2
253 +2 2
253 3
254 3
254 record change 1/4 to '1.txt'? [Ynsfdaq?]
255 record change 1/4 to '1.txt'? [Ynesfdaq?]
255 @@ -3,3 +3,3 @@
256 @@ -3,3 +3,3 @@
256 3
257 3
257 -4
258 -4
258 +4 4
259 +4 4
259 5
260 5
260 record change 2/4 to '1.txt'? [Ynsfdaq?]
261 record change 2/4 to '1.txt'? [Ynesfdaq?]
261 diff --git a/2.txt b/2.txt
262 diff --git a/2.txt b/2.txt
262 1 hunks, 1 lines changed
263 1 hunks, 1 lines changed
263 examine changes to '2.txt'? [Ynsfdaq?]
264 examine changes to '2.txt'? [Ynesfdaq?]
264 @@ -1,5 +1,5 @@
265 @@ -1,5 +1,5 @@
265 a
266 a
266 -b
267 -b
267 +b b
268 +b b
268 c
269 c
269 d
270 d
270 e
271 e
271 record change 3/4 to '2.txt'? [Ynsfdaq?]
272 record change 3/4 to '2.txt'? [Ynesfdaq?]
272 diff --git a/dir/a.txt b/dir/a.txt
273 diff --git a/dir/a.txt b/dir/a.txt
273 1 hunks, 1 lines changed
274 1 hunks, 1 lines changed
274 examine changes to 'dir/a.txt'? [Ynsfdaq?]
275 examine changes to 'dir/a.txt'? [Ynesfdaq?]
275
276
276 After qrecord a.patch 'tip'"
277 After qrecord a.patch 'tip'"
277
278
278 $ hg tip -p
279 $ hg tip -p
279 changeset: 1:5d1ca63427ee
280 changeset: 1:5d1ca63427ee
280 tag: a.patch
281 tag: a.patch
281 tag: qbase
282 tag: qbase
282 tag: qtip
283 tag: qtip
283 tag: tip
284 tag: tip
284 user: test
285 user: test
285 date: Thu Jan 01 00:00:00 1970 +0000
286 date: Thu Jan 01 00:00:00 1970 +0000
286 summary: aaa
287 summary: aaa
287
288
288 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
289 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
289 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
290 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
290 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
291 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
291 @@ -1,5 +1,5 @@
292 @@ -1,5 +1,5 @@
292 1
293 1
293 -2
294 -2
294 +2 2
295 +2 2
295 3
296 3
296 4
297 4
297 5
298 5
298 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
299 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
299 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
300 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
300 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
301 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
301 @@ -1,5 +1,5 @@
302 @@ -1,5 +1,5 @@
302 a
303 a
303 -b
304 -b
304 +b b
305 +b b
305 c
306 c
306 d
307 d
307 e
308 e
308
309
309
310
310 After qrecord a.patch 'diff'"
311 After qrecord a.patch 'diff'"
311
312
312 $ hg diff --nodates
313 $ hg diff --nodates
313 diff -r 5d1ca63427ee 1.txt
314 diff -r 5d1ca63427ee 1.txt
314 --- a/1.txt
315 --- a/1.txt
315 +++ b/1.txt
316 +++ b/1.txt
316 @@ -1,5 +1,5 @@
317 @@ -1,5 +1,5 @@
317 1
318 1
318 2 2
319 2 2
319 3
320 3
320 -4
321 -4
321 +4 4
322 +4 4
322 5
323 5
323 diff -r 5d1ca63427ee dir/a.txt
324 diff -r 5d1ca63427ee dir/a.txt
324 --- a/dir/a.txt
325 --- a/dir/a.txt
325 +++ b/dir/a.txt
326 +++ b/dir/a.txt
326 @@ -1,4 +1,4 @@
327 @@ -1,4 +1,4 @@
327 -hello world
328 -hello world
328 +hello world!
329 +hello world!
329
330
330 someone
331 someone
331 up
332 up
332
333
333 qrecord b.patch
334 qrecord b.patch
334
335
335 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
336 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
336 > y
337 > y
337 > y
338 > y
338 > y
339 > y
339 > y
340 > y
340 > EOF
341 > EOF
341 diff --git a/1.txt b/1.txt
342 diff --git a/1.txt b/1.txt
342 1 hunks, 1 lines changed
343 1 hunks, 1 lines changed
343 examine changes to '1.txt'? [Ynsfdaq?]
344 examine changes to '1.txt'? [Ynesfdaq?]
344 @@ -1,5 +1,5 @@
345 @@ -1,5 +1,5 @@
345 1
346 1
346 2 2
347 2 2
347 3
348 3
348 -4
349 -4
349 +4 4
350 +4 4
350 5
351 5
351 record change 1/2 to '1.txt'? [Ynsfdaq?]
352 record change 1/2 to '1.txt'? [Ynesfdaq?]
352 diff --git a/dir/a.txt b/dir/a.txt
353 diff --git a/dir/a.txt b/dir/a.txt
353 1 hunks, 1 lines changed
354 1 hunks, 1 lines changed
354 examine changes to 'dir/a.txt'? [Ynsfdaq?]
355 examine changes to 'dir/a.txt'? [Ynesfdaq?]
355 @@ -1,4 +1,4 @@
356 @@ -1,4 +1,4 @@
356 -hello world
357 -hello world
357 +hello world!
358 +hello world!
358
359
359 someone
360 someone
360 up
361 up
361 record change 2/2 to 'dir/a.txt'? [Ynsfdaq?]
362 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
362
363
363 After qrecord b.patch 'tip'
364 After qrecord b.patch 'tip'
364
365
365 $ hg tip -p
366 $ hg tip -p
366 changeset: 2:b056198bf878
367 changeset: 2:b056198bf878
367 tag: b.patch
368 tag: b.patch
368 tag: qtip
369 tag: qtip
369 tag: tip
370 tag: tip
370 user: test
371 user: test
371 date: Thu Jan 01 00:00:00 1970 +0000
372 date: Thu Jan 01 00:00:00 1970 +0000
372 summary: bbb
373 summary: bbb
373
374
374 diff -r 5d1ca63427ee -r b056198bf878 1.txt
375 diff -r 5d1ca63427ee -r b056198bf878 1.txt
375 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
376 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
376 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
377 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
377 @@ -1,5 +1,5 @@
378 @@ -1,5 +1,5 @@
378 1
379 1
379 2 2
380 2 2
380 3
381 3
381 -4
382 -4
382 +4 4
383 +4 4
383 5
384 5
384 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
385 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
385 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
386 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
386 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
387 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
387 @@ -1,4 +1,4 @@
388 @@ -1,4 +1,4 @@
388 -hello world
389 -hello world
389 +hello world!
390 +hello world!
390
391
391 someone
392 someone
392 up
393 up
393
394
394
395
395 After qrecord b.patch 'diff'
396 After qrecord b.patch 'diff'
396
397
397 $ hg diff --nodates
398 $ hg diff --nodates
@@ -1,964 +1,1108 b''
1 $ "$TESTDIR/hghave" execbit || exit 80
1 $ "$TESTDIR/hghave" execbit || exit 80
2
2
3 Set up a repo
3 Set up a repo
4
4
5 $ echo "[ui]" >> $HGRCPATH
5 $ echo "[ui]" >> $HGRCPATH
6 $ echo "interactive=true" >> $HGRCPATH
6 $ echo "interactive=true" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "record=" >> $HGRCPATH
8 $ echo "record=" >> $HGRCPATH
9
9
10 $ hg init a
10 $ hg init a
11 $ cd a
11 $ cd a
12
12
13 Select no files
13 Select no files
14
14
15 $ touch empty-rw
15 $ touch empty-rw
16 $ hg add empty-rw
16 $ hg add empty-rw
17
17
18 $ hg record empty-rw<<EOF
18 $ hg record empty-rw<<EOF
19 > n
19 > n
20 > EOF
20 > EOF
21 diff --git a/empty-rw b/empty-rw
21 diff --git a/empty-rw b/empty-rw
22 new file mode 100644
22 new file mode 100644
23 examine changes to 'empty-rw'? [Ynsfdaq?]
23 examine changes to 'empty-rw'? [Ynesfdaq?]
24 no changes to record
24 no changes to record
25
25
26 $ hg tip -p
26 $ hg tip -p
27 changeset: -1:000000000000
27 changeset: -1:000000000000
28 tag: tip
28 tag: tip
29 user:
29 user:
30 date: Thu Jan 01 00:00:00 1970 +0000
30 date: Thu Jan 01 00:00:00 1970 +0000
31
31
32
32
33
33
34 Select files but no hunks
34 Select files but no hunks
35
35
36 $ hg record empty-rw<<EOF
36 $ hg record empty-rw<<EOF
37 > y
37 > y
38 > n
38 > n
39 > EOF
39 > EOF
40 diff --git a/empty-rw b/empty-rw
40 diff --git a/empty-rw b/empty-rw
41 new file mode 100644
41 new file mode 100644
42 examine changes to 'empty-rw'? [Ynsfdaq?]
42 examine changes to 'empty-rw'? [Ynesfdaq?]
43 abort: empty commit message
43 abort: empty commit message
44 [255]
44 [255]
45
45
46 $ hg tip -p
46 $ hg tip -p
47 changeset: -1:000000000000
47 changeset: -1:000000000000
48 tag: tip
48 tag: tip
49 user:
49 user:
50 date: Thu Jan 01 00:00:00 1970 +0000
50 date: Thu Jan 01 00:00:00 1970 +0000
51
51
52
52
53
53
54 Record empty file
54 Record empty file
55
55
56 $ hg record -d '0 0' -m empty empty-rw<<EOF
56 $ hg record -d '0 0' -m empty empty-rw<<EOF
57 > y
57 > y
58 > y
58 > y
59 > EOF
59 > EOF
60 diff --git a/empty-rw b/empty-rw
60 diff --git a/empty-rw b/empty-rw
61 new file mode 100644
61 new file mode 100644
62 examine changes to 'empty-rw'? [Ynsfdaq?]
62 examine changes to 'empty-rw'? [Ynesfdaq?]
63
63
64 $ hg tip -p
64 $ hg tip -p
65 changeset: 0:c0708cf4e46e
65 changeset: 0:c0708cf4e46e
66 tag: tip
66 tag: tip
67 user: test
67 user: test
68 date: Thu Jan 01 00:00:00 1970 +0000
68 date: Thu Jan 01 00:00:00 1970 +0000
69 summary: empty
69 summary: empty
70
70
71
71
72
72
73 Summary shows we updated to the new cset
73 Summary shows we updated to the new cset
74
74
75 $ hg summary
75 $ hg summary
76 parent: 0:c0708cf4e46e tip
76 parent: 0:c0708cf4e46e tip
77 empty
77 empty
78 branch: default
78 branch: default
79 commit: (clean)
79 commit: (clean)
80 update: (current)
80 update: (current)
81
81
82 Rename empty file
82 Rename empty file
83
83
84 $ hg mv empty-rw empty-rename
84 $ hg mv empty-rw empty-rename
85 $ hg record -d '1 0' -m rename<<EOF
85 $ hg record -d '1 0' -m rename<<EOF
86 > y
86 > y
87 > EOF
87 > EOF
88 diff --git a/empty-rw b/empty-rename
88 diff --git a/empty-rw b/empty-rename
89 rename from empty-rw
89 rename from empty-rw
90 rename to empty-rename
90 rename to empty-rename
91 examine changes to 'empty-rw' and 'empty-rename'? [Ynsfdaq?]
91 examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?]
92
92
93 $ hg tip -p
93 $ hg tip -p
94 changeset: 1:d695e8dcb197
94 changeset: 1:d695e8dcb197
95 tag: tip
95 tag: tip
96 user: test
96 user: test
97 date: Thu Jan 01 00:00:01 1970 +0000
97 date: Thu Jan 01 00:00:01 1970 +0000
98 summary: rename
98 summary: rename
99
99
100
100
101
101
102 Copy empty file
102 Copy empty file
103
103
104 $ hg cp empty-rename empty-copy
104 $ hg cp empty-rename empty-copy
105 $ hg record -d '2 0' -m copy<<EOF
105 $ hg record -d '2 0' -m copy<<EOF
106 > y
106 > y
107 > EOF
107 > EOF
108 diff --git a/empty-rename b/empty-copy
108 diff --git a/empty-rename b/empty-copy
109 copy from empty-rename
109 copy from empty-rename
110 copy to empty-copy
110 copy to empty-copy
111 examine changes to 'empty-rename' and 'empty-copy'? [Ynsfdaq?]
111 examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?]
112
112
113 $ hg tip -p
113 $ hg tip -p
114 changeset: 2:1d4b90bea524
114 changeset: 2:1d4b90bea524
115 tag: tip
115 tag: tip
116 user: test
116 user: test
117 date: Thu Jan 01 00:00:02 1970 +0000
117 date: Thu Jan 01 00:00:02 1970 +0000
118 summary: copy
118 summary: copy
119
119
120
120
121
121
122 Delete empty file
122 Delete empty file
123
123
124 $ hg rm empty-copy
124 $ hg rm empty-copy
125 $ hg record -d '3 0' -m delete<<EOF
125 $ hg record -d '3 0' -m delete<<EOF
126 > y
126 > y
127 > EOF
127 > EOF
128 diff --git a/empty-copy b/empty-copy
128 diff --git a/empty-copy b/empty-copy
129 deleted file mode 100644
129 deleted file mode 100644
130 examine changes to 'empty-copy'? [Ynsfdaq?]
130 examine changes to 'empty-copy'? [Ynesfdaq?]
131
131
132 $ hg tip -p
132 $ hg tip -p
133 changeset: 3:b39a238f01a1
133 changeset: 3:b39a238f01a1
134 tag: tip
134 tag: tip
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:03 1970 +0000
136 date: Thu Jan 01 00:00:03 1970 +0000
137 summary: delete
137 summary: delete
138
138
139
139
140
140
141 Add binary file
141 Add binary file
142
142
143 $ hg bundle --base -2 tip.bundle
143 $ hg bundle --base -2 tip.bundle
144 1 changesets found
144 1 changesets found
145 $ hg add tip.bundle
145 $ hg add tip.bundle
146 $ hg record -d '4 0' -m binary<<EOF
146 $ hg record -d '4 0' -m binary<<EOF
147 > y
147 > y
148 > EOF
148 > EOF
149 diff --git a/tip.bundle b/tip.bundle
149 diff --git a/tip.bundle b/tip.bundle
150 new file mode 100644
150 new file mode 100644
151 this is a binary file
151 this is a binary file
152 examine changes to 'tip.bundle'? [Ynsfdaq?]
152 examine changes to 'tip.bundle'? [Ynesfdaq?]
153
153
154 $ hg tip -p
154 $ hg tip -p
155 changeset: 4:ad816da3711e
155 changeset: 4:ad816da3711e
156 tag: tip
156 tag: tip
157 user: test
157 user: test
158 date: Thu Jan 01 00:00:04 1970 +0000
158 date: Thu Jan 01 00:00:04 1970 +0000
159 summary: binary
159 summary: binary
160
160
161 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
161 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
162 Binary file tip.bundle has changed
162 Binary file tip.bundle has changed
163
163
164
164
165 Change binary file
165 Change binary file
166
166
167 $ hg bundle --base -2 tip.bundle
167 $ hg bundle --base -2 tip.bundle
168 1 changesets found
168 1 changesets found
169 $ hg record -d '5 0' -m binary-change<<EOF
169 $ hg record -d '5 0' -m binary-change<<EOF
170 > y
170 > y
171 > EOF
171 > EOF
172 diff --git a/tip.bundle b/tip.bundle
172 diff --git a/tip.bundle b/tip.bundle
173 this modifies a binary file (all or nothing)
173 this modifies a binary file (all or nothing)
174 examine changes to 'tip.bundle'? [Ynsfdaq?]
174 examine changes to 'tip.bundle'? [Ynesfdaq?]
175
175
176 $ hg tip -p
176 $ hg tip -p
177 changeset: 5:dccd6f3eb485
177 changeset: 5:dccd6f3eb485
178 tag: tip
178 tag: tip
179 user: test
179 user: test
180 date: Thu Jan 01 00:00:05 1970 +0000
180 date: Thu Jan 01 00:00:05 1970 +0000
181 summary: binary-change
181 summary: binary-change
182
182
183 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
183 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
184 Binary file tip.bundle has changed
184 Binary file tip.bundle has changed
185
185
186
186
187 Rename and change binary file
187 Rename and change binary file
188
188
189 $ hg mv tip.bundle top.bundle
189 $ hg mv tip.bundle top.bundle
190 $ hg bundle --base -2 top.bundle
190 $ hg bundle --base -2 top.bundle
191 1 changesets found
191 1 changesets found
192 $ hg record -d '6 0' -m binary-change-rename<<EOF
192 $ hg record -d '6 0' -m binary-change-rename<<EOF
193 > y
193 > y
194 > EOF
194 > EOF
195 diff --git a/tip.bundle b/top.bundle
195 diff --git a/tip.bundle b/top.bundle
196 rename from tip.bundle
196 rename from tip.bundle
197 rename to top.bundle
197 rename to top.bundle
198 this modifies a binary file (all or nothing)
198 this modifies a binary file (all or nothing)
199 examine changes to 'tip.bundle' and 'top.bundle'? [Ynsfdaq?]
199 examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?]
200
200
201 $ hg tip -p
201 $ hg tip -p
202 changeset: 6:7fa44105f5b3
202 changeset: 6:7fa44105f5b3
203 tag: tip
203 tag: tip
204 user: test
204 user: test
205 date: Thu Jan 01 00:00:06 1970 +0000
205 date: Thu Jan 01 00:00:06 1970 +0000
206 summary: binary-change-rename
206 summary: binary-change-rename
207
207
208 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
208 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
209 Binary file tip.bundle has changed
209 Binary file tip.bundle has changed
210 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
210 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
211 Binary file top.bundle has changed
211 Binary file top.bundle has changed
212
212
213
213
214 Add plain file
214 Add plain file
215
215
216 $ for i in 1 2 3 4 5 6 7 8 9 10; do
216 $ for i in 1 2 3 4 5 6 7 8 9 10; do
217 > echo $i >> plain
217 > echo $i >> plain
218 > done
218 > done
219
219
220 $ hg add plain
220 $ hg add plain
221 $ hg record -d '7 0' -m plain plain<<EOF
221 $ hg record -d '7 0' -m plain plain<<EOF
222 > y
222 > y
223 > y
223 > y
224 > EOF
224 > EOF
225 diff --git a/plain b/plain
225 diff --git a/plain b/plain
226 new file mode 100644
226 new file mode 100644
227 examine changes to 'plain'? [Ynsfdaq?]
227 examine changes to 'plain'? [Ynesfdaq?]
228
228
229 $ hg tip -p
229 $ hg tip -p
230 changeset: 7:11fb457c1be4
230 changeset: 7:11fb457c1be4
231 tag: tip
231 tag: tip
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:07 1970 +0000
233 date: Thu Jan 01 00:00:07 1970 +0000
234 summary: plain
234 summary: plain
235
235
236 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
236 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
237 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
237 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
238 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
238 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
239 @@ -0,0 +1,10 @@
239 @@ -0,0 +1,10 @@
240 +1
240 +1
241 +2
241 +2
242 +3
242 +3
243 +4
243 +4
244 +5
244 +5
245 +6
245 +6
246 +7
246 +7
247 +8
247 +8
248 +9
248 +9
249 +10
249 +10
250
250
251
251
252 Modify end of plain file
252 Modify end of plain file
253
253
254 $ echo 11 >> plain
254 $ echo 11 >> plain
255 $ hg record -d '8 0' -m end plain <<EOF
255 $ hg record -d '8 0' -m end plain <<EOF
256 > y
256 > y
257 > y
257 > y
258 > EOF
258 > EOF
259 diff --git a/plain b/plain
259 diff --git a/plain b/plain
260 1 hunks, 1 lines changed
260 1 hunks, 1 lines changed
261 examine changes to 'plain'? [Ynsfdaq?]
261 examine changes to 'plain'? [Ynesfdaq?]
262 @@ -8,3 +8,4 @@
262 @@ -8,3 +8,4 @@
263 8
263 8
264 9
264 9
265 10
265 10
266 +11
266 +11
267 record this change to 'plain'? [Ynsfdaq?]
267 record this change to 'plain'? [Ynesfdaq?]
268
268
269 Modify end of plain file, no EOL
269 Modify end of plain file, no EOL
270
270
271 $ hg tip --template '{node}' >> plain
271 $ hg tip --template '{node}' >> plain
272 $ hg record -d '9 0' -m noeol plain <<EOF
272 $ hg record -d '9 0' -m noeol plain <<EOF
273 > y
273 > y
274 > y
274 > y
275 > EOF
275 > EOF
276 diff --git a/plain b/plain
276 diff --git a/plain b/plain
277 1 hunks, 1 lines changed
277 1 hunks, 1 lines changed
278 examine changes to 'plain'? [Ynsfdaq?]
278 examine changes to 'plain'? [Ynesfdaq?]
279 @@ -9,3 +9,4 @@
279 @@ -9,3 +9,4 @@
280 9
280 9
281 10
281 10
282 11
282 11
283 +7264f99c5f5ff3261504828afa4fb4d406c3af54
283 +7264f99c5f5ff3261504828afa4fb4d406c3af54
284 \ No newline at end of file
284 \ No newline at end of file
285 record this change to 'plain'? [Ynsfdaq?]
285 record this change to 'plain'? [Ynesfdaq?]
286
286
287 Modify end of plain file, add EOL
287 Modify end of plain file, add EOL
288
288
289 $ echo >> plain
289 $ echo >> plain
290 $ echo 1 > plain2
290 $ echo 1 > plain2
291 $ hg add plain2
291 $ hg add plain2
292 $ hg record -d '10 0' -m eol plain plain2 <<EOF
292 $ hg record -d '10 0' -m eol plain plain2 <<EOF
293 > y
293 > y
294 > y
294 > y
295 > y
295 > y
296 > EOF
296 > EOF
297 diff --git a/plain b/plain
297 diff --git a/plain b/plain
298 1 hunks, 1 lines changed
298 1 hunks, 1 lines changed
299 examine changes to 'plain'? [Ynsfdaq?]
299 examine changes to 'plain'? [Ynesfdaq?]
300 @@ -9,4 +9,4 @@
300 @@ -9,4 +9,4 @@
301 9
301 9
302 10
302 10
303 11
303 11
304 -7264f99c5f5ff3261504828afa4fb4d406c3af54
304 -7264f99c5f5ff3261504828afa4fb4d406c3af54
305 \ No newline at end of file
305 \ No newline at end of file
306 +7264f99c5f5ff3261504828afa4fb4d406c3af54
306 +7264f99c5f5ff3261504828afa4fb4d406c3af54
307 record change 1/2 to 'plain'? [Ynsfdaq?]
307 record change 1/2 to 'plain'? [Ynesfdaq?]
308 diff --git a/plain2 b/plain2
308 diff --git a/plain2 b/plain2
309 new file mode 100644
309 new file mode 100644
310 examine changes to 'plain2'? [Ynsfdaq?]
310 examine changes to 'plain2'? [Ynesfdaq?]
311
311
312 Modify beginning, trim end, record both, add another file to test
312 Modify beginning, trim end, record both, add another file to test
313 changes numbering
313 changes numbering
314
314
315 $ rm plain
315 $ rm plain
316 $ for i in 2 2 3 4 5 6 7 8 9 10; do
316 $ for i in 2 2 3 4 5 6 7 8 9 10; do
317 > echo $i >> plain
317 > echo $i >> plain
318 > done
318 > done
319 $ echo 2 >> plain2
319 $ echo 2 >> plain2
320
320
321 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
321 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
322 > y
322 > y
323 > y
323 > y
324 > y
324 > y
325 > y
325 > y
326 > y
326 > y
327 > EOF
327 > EOF
328 diff --git a/plain b/plain
328 diff --git a/plain b/plain
329 2 hunks, 3 lines changed
329 2 hunks, 3 lines changed
330 examine changes to 'plain'? [Ynsfdaq?]
330 examine changes to 'plain'? [Ynesfdaq?]
331 @@ -1,4 +1,4 @@
331 @@ -1,4 +1,4 @@
332 -1
332 -1
333 +2
333 +2
334 2
334 2
335 3
335 3
336 4
336 4
337 record change 1/3 to 'plain'? [Ynsfdaq?]
337 record change 1/3 to 'plain'? [Ynesfdaq?]
338 @@ -8,5 +8,3 @@
338 @@ -8,5 +8,3 @@
339 8
339 8
340 9
340 9
341 10
341 10
342 -11
342 -11
343 -7264f99c5f5ff3261504828afa4fb4d406c3af54
343 -7264f99c5f5ff3261504828afa4fb4d406c3af54
344 record change 2/3 to 'plain'? [Ynsfdaq?]
344 record change 2/3 to 'plain'? [Ynesfdaq?]
345 diff --git a/plain2 b/plain2
345 diff --git a/plain2 b/plain2
346 1 hunks, 1 lines changed
346 1 hunks, 1 lines changed
347 examine changes to 'plain2'? [Ynsfdaq?]
347 examine changes to 'plain2'? [Ynesfdaq?]
348 @@ -1,1 +1,2 @@
348 @@ -1,1 +1,2 @@
349 1
349 1
350 +2
350 +2
351 record change 3/3 to 'plain2'? [Ynsfdaq?]
351 record change 3/3 to 'plain2'? [Ynesfdaq?]
352
352
353 $ hg tip -p
353 $ hg tip -p
354 changeset: 11:21df83db12b8
354 changeset: 11:21df83db12b8
355 tag: tip
355 tag: tip
356 user: test
356 user: test
357 date: Thu Jan 01 00:00:10 1970 +0000
357 date: Thu Jan 01 00:00:10 1970 +0000
358 summary: begin-and-end
358 summary: begin-and-end
359
359
360 diff -r ddb8b281c3ff -r 21df83db12b8 plain
360 diff -r ddb8b281c3ff -r 21df83db12b8 plain
361 --- a/plain Thu Jan 01 00:00:10 1970 +0000
361 --- a/plain Thu Jan 01 00:00:10 1970 +0000
362 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
362 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
363 @@ -1,4 +1,4 @@
363 @@ -1,4 +1,4 @@
364 -1
364 -1
365 +2
365 +2
366 2
366 2
367 3
367 3
368 4
368 4
369 @@ -8,5 +8,3 @@
369 @@ -8,5 +8,3 @@
370 8
370 8
371 9
371 9
372 10
372 10
373 -11
373 -11
374 -7264f99c5f5ff3261504828afa4fb4d406c3af54
374 -7264f99c5f5ff3261504828afa4fb4d406c3af54
375 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
375 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
376 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
376 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
377 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
377 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
378 @@ -1,1 +1,2 @@
378 @@ -1,1 +1,2 @@
379 1
379 1
380 +2
380 +2
381
381
382
382
383 Trim beginning, modify end
383 Trim beginning, modify end
384
384
385 $ rm plain
385 $ rm plain
386 > for i in 4 5 6 7 8 9 10.new; do
386 > for i in 4 5 6 7 8 9 10.new; do
387 > echo $i >> plain
387 > echo $i >> plain
388 > done
388 > done
389
389
390 Record end
390 Record end
391
391
392 $ hg record -d '11 0' -m end-only plain <<EOF
392 $ hg record -d '11 0' -m end-only plain <<EOF
393 > y
393 > y
394 > n
394 > n
395 > y
395 > y
396 > EOF
396 > EOF
397 diff --git a/plain b/plain
397 diff --git a/plain b/plain
398 2 hunks, 4 lines changed
398 2 hunks, 4 lines changed
399 examine changes to 'plain'? [Ynsfdaq?]
399 examine changes to 'plain'? [Ynesfdaq?]
400 @@ -1,9 +1,6 @@
400 @@ -1,9 +1,6 @@
401 -2
401 -2
402 -2
402 -2
403 -3
403 -3
404 4
404 4
405 5
405 5
406 6
406 6
407 7
407 7
408 8
408 8
409 9
409 9
410 record change 1/2 to 'plain'? [Ynsfdaq?]
410 record change 1/2 to 'plain'? [Ynesfdaq?]
411 @@ -4,7 +1,7 @@
411 @@ -4,7 +1,7 @@
412 4
412 4
413 5
413 5
414 6
414 6
415 7
415 7
416 8
416 8
417 9
417 9
418 -10
418 -10
419 +10.new
419 +10.new
420 record change 2/2 to 'plain'? [Ynsfdaq?]
420 record change 2/2 to 'plain'? [Ynesfdaq?]
421
421
422 $ hg tip -p
422 $ hg tip -p
423 changeset: 12:99337501826f
423 changeset: 12:99337501826f
424 tag: tip
424 tag: tip
425 user: test
425 user: test
426 date: Thu Jan 01 00:00:11 1970 +0000
426 date: Thu Jan 01 00:00:11 1970 +0000
427 summary: end-only
427 summary: end-only
428
428
429 diff -r 21df83db12b8 -r 99337501826f plain
429 diff -r 21df83db12b8 -r 99337501826f plain
430 --- a/plain Thu Jan 01 00:00:10 1970 +0000
430 --- a/plain Thu Jan 01 00:00:10 1970 +0000
431 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
431 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
432 @@ -7,4 +7,4 @@
432 @@ -7,4 +7,4 @@
433 7
433 7
434 8
434 8
435 9
435 9
436 -10
436 -10
437 +10.new
437 +10.new
438
438
439
439
440 Record beginning
440 Record beginning
441
441
442 $ hg record -d '12 0' -m begin-only plain <<EOF
442 $ hg record -d '12 0' -m begin-only plain <<EOF
443 > y
443 > y
444 > y
444 > y
445 > EOF
445 > EOF
446 diff --git a/plain b/plain
446 diff --git a/plain b/plain
447 1 hunks, 3 lines changed
447 1 hunks, 3 lines changed
448 examine changes to 'plain'? [Ynsfdaq?]
448 examine changes to 'plain'? [Ynesfdaq?]
449 @@ -1,6 +1,3 @@
449 @@ -1,6 +1,3 @@
450 -2
450 -2
451 -2
451 -2
452 -3
452 -3
453 4
453 4
454 5
454 5
455 6
455 6
456 record this change to 'plain'? [Ynsfdaq?]
456 record this change to 'plain'? [Ynesfdaq?]
457
457
458 $ hg tip -p
458 $ hg tip -p
459 changeset: 13:bbd45465d540
459 changeset: 13:bbd45465d540
460 tag: tip
460 tag: tip
461 user: test
461 user: test
462 date: Thu Jan 01 00:00:12 1970 +0000
462 date: Thu Jan 01 00:00:12 1970 +0000
463 summary: begin-only
463 summary: begin-only
464
464
465 diff -r 99337501826f -r bbd45465d540 plain
465 diff -r 99337501826f -r bbd45465d540 plain
466 --- a/plain Thu Jan 01 00:00:11 1970 +0000
466 --- a/plain Thu Jan 01 00:00:11 1970 +0000
467 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
467 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
468 @@ -1,6 +1,3 @@
468 @@ -1,6 +1,3 @@
469 -2
469 -2
470 -2
470 -2
471 -3
471 -3
472 4
472 4
473 5
473 5
474 6
474 6
475
475
476
476
477 Add to beginning, trim from end
477 Add to beginning, trim from end
478
478
479 $ rm plain
479 $ rm plain
480 $ for i in 1 2 3 4 5 6 7 8 9; do
480 $ for i in 1 2 3 4 5 6 7 8 9; do
481 > echo $i >> plain
481 > echo $i >> plain
482 > done
482 > done
483
483
484 Record end
484 Record end
485
485
486 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
486 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
487 > y
487 > y
488 > n
488 > n
489 > y
489 > y
490 > EOF
490 > EOF
491 diff --git a/plain b/plain
491 diff --git a/plain b/plain
492 2 hunks, 4 lines changed
492 2 hunks, 4 lines changed
493 examine changes to 'plain'? [Ynsfdaq?]
493 examine changes to 'plain'? [Ynesfdaq?]
494 @@ -1,6 +1,9 @@
494 @@ -1,6 +1,9 @@
495 +1
495 +1
496 +2
496 +2
497 +3
497 +3
498 4
498 4
499 5
499 5
500 6
500 6
501 7
501 7
502 8
502 8
503 9
503 9
504 record change 1/2 to 'plain'? [Ynsfdaq?]
504 record change 1/2 to 'plain'? [Ynesfdaq?]
505 @@ -1,7 +4,6 @@
505 @@ -1,7 +4,6 @@
506 4
506 4
507 5
507 5
508 6
508 6
509 7
509 7
510 8
510 8
511 9
511 9
512 -10.new
512 -10.new
513 record change 2/2 to 'plain'? [Ynsfdaq?]
513 record change 2/2 to 'plain'? [Ynesfdaq?]
514
514
515 Add to beginning, middle, end
515 Add to beginning, middle, end
516
516
517 $ rm plain
517 $ rm plain
518 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
518 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
519 > echo $i >> plain
519 > echo $i >> plain
520 > done
520 > done
521
521
522 Record beginning, middle
522 Record beginning, middle
523
523
524 $ hg record -d '14 0' -m middle-only plain <<EOF
524 $ hg record -d '14 0' -m middle-only plain <<EOF
525 > y
525 > y
526 > y
526 > y
527 > y
527 > y
528 > n
528 > n
529 > EOF
529 > EOF
530 diff --git a/plain b/plain
530 diff --git a/plain b/plain
531 3 hunks, 7 lines changed
531 3 hunks, 7 lines changed
532 examine changes to 'plain'? [Ynsfdaq?]
532 examine changes to 'plain'? [Ynesfdaq?]
533 @@ -1,2 +1,5 @@
533 @@ -1,2 +1,5 @@
534 +1
534 +1
535 +2
535 +2
536 +3
536 +3
537 4
537 4
538 5
538 5
539 record change 1/3 to 'plain'? [Ynsfdaq?]
539 record change 1/3 to 'plain'? [Ynesfdaq?]
540 @@ -1,6 +4,8 @@
540 @@ -1,6 +4,8 @@
541 4
541 4
542 5
542 5
543 +5.new
543 +5.new
544 +5.reallynew
544 +5.reallynew
545 6
545 6
546 7
546 7
547 8
547 8
548 9
548 9
549 record change 2/3 to 'plain'? [Ynsfdaq?]
549 record change 2/3 to 'plain'? [Ynesfdaq?]
550 @@ -3,4 +8,6 @@
550 @@ -3,4 +8,6 @@
551 6
551 6
552 7
552 7
553 8
553 8
554 9
554 9
555 +10
555 +10
556 +11
556 +11
557 record change 3/3 to 'plain'? [Ynsfdaq?]
557 record change 3/3 to 'plain'? [Ynesfdaq?]
558
558
559 $ hg tip -p
559 $ hg tip -p
560 changeset: 15:f34a7937ec33
560 changeset: 15:f34a7937ec33
561 tag: tip
561 tag: tip
562 user: test
562 user: test
563 date: Thu Jan 01 00:00:14 1970 +0000
563 date: Thu Jan 01 00:00:14 1970 +0000
564 summary: middle-only
564 summary: middle-only
565
565
566 diff -r 82c065d0b850 -r f34a7937ec33 plain
566 diff -r 82c065d0b850 -r f34a7937ec33 plain
567 --- a/plain Thu Jan 01 00:00:13 1970 +0000
567 --- a/plain Thu Jan 01 00:00:13 1970 +0000
568 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
568 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
569 @@ -1,5 +1,10 @@
569 @@ -1,5 +1,10 @@
570 +1
570 +1
571 +2
571 +2
572 +3
572 +3
573 4
573 4
574 5
574 5
575 +5.new
575 +5.new
576 +5.reallynew
576 +5.reallynew
577 6
577 6
578 7
578 7
579 8
579 8
580
580
581
581
582 Record end
582 Record end
583
583
584 $ hg record -d '15 0' -m end-only plain <<EOF
584 $ hg record -d '15 0' -m end-only plain <<EOF
585 > y
585 > y
586 > y
586 > y
587 > EOF
587 > EOF
588 diff --git a/plain b/plain
588 diff --git a/plain b/plain
589 1 hunks, 2 lines changed
589 1 hunks, 2 lines changed
590 examine changes to 'plain'? [Ynsfdaq?]
590 examine changes to 'plain'? [Ynesfdaq?]
591 @@ -9,3 +9,5 @@
591 @@ -9,3 +9,5 @@
592 7
592 7
593 8
593 8
594 9
594 9
595 +10
595 +10
596 +11
596 +11
597 record this change to 'plain'? [Ynsfdaq?]
597 record this change to 'plain'? [Ynesfdaq?]
598
598
599 $ hg tip -p
599 $ hg tip -p
600 changeset: 16:f9900b71a04c
600 changeset: 16:f9900b71a04c
601 tag: tip
601 tag: tip
602 user: test
602 user: test
603 date: Thu Jan 01 00:00:15 1970 +0000
603 date: Thu Jan 01 00:00:15 1970 +0000
604 summary: end-only
604 summary: end-only
605
605
606 diff -r f34a7937ec33 -r f9900b71a04c plain
606 diff -r f34a7937ec33 -r f9900b71a04c plain
607 --- a/plain Thu Jan 01 00:00:14 1970 +0000
607 --- a/plain Thu Jan 01 00:00:14 1970 +0000
608 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
608 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
609 @@ -9,3 +9,5 @@
609 @@ -9,3 +9,5 @@
610 7
610 7
611 8
611 8
612 9
612 9
613 +10
613 +10
614 +11
614 +11
615
615
616
616
617 $ mkdir subdir
617 $ mkdir subdir
618 $ cd subdir
618 $ cd subdir
619 $ echo a > a
619 $ echo a > a
620 $ hg ci -d '16 0' -Amsubdir
620 $ hg ci -d '16 0' -Amsubdir
621 adding subdir/a
621 adding subdir/a
622
622
623 $ echo a >> a
623 $ echo a >> a
624 $ hg record -d '16 0' -m subdir-change a <<EOF
624 $ hg record -d '16 0' -m subdir-change a <<EOF
625 > y
625 > y
626 > y
626 > y
627 > EOF
627 > EOF
628 diff --git a/subdir/a b/subdir/a
628 diff --git a/subdir/a b/subdir/a
629 1 hunks, 1 lines changed
629 1 hunks, 1 lines changed
630 examine changes to 'subdir/a'? [Ynsfdaq?]
630 examine changes to 'subdir/a'? [Ynesfdaq?]
631 @@ -1,1 +1,2 @@
631 @@ -1,1 +1,2 @@
632 a
632 a
633 +a
633 +a
634 record this change to 'subdir/a'? [Ynsfdaq?]
634 record this change to 'subdir/a'? [Ynesfdaq?]
635
635
636 $ hg tip -p
636 $ hg tip -p
637 changeset: 18:61be427a9deb
637 changeset: 18:61be427a9deb
638 tag: tip
638 tag: tip
639 user: test
639 user: test
640 date: Thu Jan 01 00:00:16 1970 +0000
640 date: Thu Jan 01 00:00:16 1970 +0000
641 summary: subdir-change
641 summary: subdir-change
642
642
643 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
643 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
644 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
644 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
645 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
645 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
646 @@ -1,1 +1,2 @@
646 @@ -1,1 +1,2 @@
647 a
647 a
648 +a
648 +a
649
649
650
650
651 $ echo a > f1
651 $ echo a > f1
652 $ echo b > f2
652 $ echo b > f2
653 $ hg add f1 f2
653 $ hg add f1 f2
654
654
655 $ hg ci -mz -d '17 0'
655 $ hg ci -mz -d '17 0'
656
656
657 $ echo a >> f1
657 $ echo a >> f1
658 $ echo b >> f2
658 $ echo b >> f2
659
659
660 Help, quit
660 Help, quit
661
661
662 $ hg record <<EOF
662 $ hg record <<EOF
663 > ?
663 > ?
664 > q
664 > q
665 > EOF
665 > EOF
666 diff --git a/subdir/f1 b/subdir/f1
666 diff --git a/subdir/f1 b/subdir/f1
667 1 hunks, 1 lines changed
667 1 hunks, 1 lines changed
668 examine changes to 'subdir/f1'? [Ynsfdaq?]
668 examine changes to 'subdir/f1'? [Ynesfdaq?]
669 y - record this change
669 y - record this change
670 n - skip this change
670 n - skip this change
671 e - edit this change manually
671 s - skip remaining changes to this file
672 s - skip remaining changes to this file
672 f - record remaining changes to this file
673 f - record remaining changes to this file
673 d - done, skip remaining changes and files
674 d - done, skip remaining changes and files
674 a - record all changes to all remaining files
675 a - record all changes to all remaining files
675 q - quit, recording no changes
676 q - quit, recording no changes
676 ? - display help
677 ? - display help
677 examine changes to 'subdir/f1'? [Ynsfdaq?]
678 examine changes to 'subdir/f1'? [Ynesfdaq?]
678 abort: user quit
679 abort: user quit
679 [255]
680 [255]
680
681
681 Skip
682 Skip
682
683
683 $ hg record <<EOF
684 $ hg record <<EOF
684 > s
685 > s
685 > EOF
686 > EOF
686 diff --git a/subdir/f1 b/subdir/f1
687 diff --git a/subdir/f1 b/subdir/f1
687 1 hunks, 1 lines changed
688 1 hunks, 1 lines changed
688 examine changes to 'subdir/f1'? [Ynsfdaq?]
689 examine changes to 'subdir/f1'? [Ynesfdaq?]
689 diff --git a/subdir/f2 b/subdir/f2
690 diff --git a/subdir/f2 b/subdir/f2
690 1 hunks, 1 lines changed
691 1 hunks, 1 lines changed
691 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
692 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
692 [255]
693 [255]
693
694
694 No
695 No
695
696
696 $ hg record <<EOF
697 $ hg record <<EOF
697 > n
698 > n
698 > EOF
699 > EOF
699 diff --git a/subdir/f1 b/subdir/f1
700 diff --git a/subdir/f1 b/subdir/f1
700 1 hunks, 1 lines changed
701 1 hunks, 1 lines changed
701 examine changes to 'subdir/f1'? [Ynsfdaq?]
702 examine changes to 'subdir/f1'? [Ynesfdaq?]
702 diff --git a/subdir/f2 b/subdir/f2
703 diff --git a/subdir/f2 b/subdir/f2
703 1 hunks, 1 lines changed
704 1 hunks, 1 lines changed
704 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
705 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
705 [255]
706 [255]
706
707
707 f, quit
708 f, quit
708
709
709 $ hg record <<EOF
710 $ hg record <<EOF
710 > f
711 > f
711 > q
712 > q
712 > EOF
713 > EOF
713 diff --git a/subdir/f1 b/subdir/f1
714 diff --git a/subdir/f1 b/subdir/f1
714 1 hunks, 1 lines changed
715 1 hunks, 1 lines changed
715 examine changes to 'subdir/f1'? [Ynsfdaq?]
716 examine changes to 'subdir/f1'? [Ynesfdaq?]
716 diff --git a/subdir/f2 b/subdir/f2
717 diff --git a/subdir/f2 b/subdir/f2
717 1 hunks, 1 lines changed
718 1 hunks, 1 lines changed
718 examine changes to 'subdir/f2'? [Ynsfdaq?]
719 examine changes to 'subdir/f2'? [Ynesfdaq?]
719 abort: user quit
720 abort: user quit
720 [255]
721 [255]
721
722
722 s, all
723 s, all
723
724
724 $ hg record -d '18 0' -mx <<EOF
725 $ hg record -d '18 0' -mx <<EOF
725 > s
726 > s
726 > a
727 > a
727 > EOF
728 > EOF
728 diff --git a/subdir/f1 b/subdir/f1
729 diff --git a/subdir/f1 b/subdir/f1
729 1 hunks, 1 lines changed
730 1 hunks, 1 lines changed
730 examine changes to 'subdir/f1'? [Ynsfdaq?]
731 examine changes to 'subdir/f1'? [Ynesfdaq?]
731 diff --git a/subdir/f2 b/subdir/f2
732 diff --git a/subdir/f2 b/subdir/f2
732 1 hunks, 1 lines changed
733 1 hunks, 1 lines changed
733 examine changes to 'subdir/f2'? [Ynsfdaq?]
734 examine changes to 'subdir/f2'? [Ynesfdaq?]
734
735
735 $ hg tip -p
736 $ hg tip -p
736 changeset: 20:b3df3dda369a
737 changeset: 20:b3df3dda369a
737 tag: tip
738 tag: tip
738 user: test
739 user: test
739 date: Thu Jan 01 00:00:18 1970 +0000
740 date: Thu Jan 01 00:00:18 1970 +0000
740 summary: x
741 summary: x
741
742
742 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
743 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
743 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
744 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
744 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
745 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
745 @@ -1,1 +1,2 @@
746 @@ -1,1 +1,2 @@
746 b
747 b
747 +b
748 +b
748
749
749
750
750 f
751 f
751
752
752 $ hg record -d '19 0' -my <<EOF
753 $ hg record -d '19 0' -my <<EOF
753 > f
754 > f
754 > EOF
755 > EOF
755 diff --git a/subdir/f1 b/subdir/f1
756 diff --git a/subdir/f1 b/subdir/f1
756 1 hunks, 1 lines changed
757 1 hunks, 1 lines changed
757 examine changes to 'subdir/f1'? [Ynsfdaq?]
758 examine changes to 'subdir/f1'? [Ynesfdaq?]
758
759
759 $ hg tip -p
760 $ hg tip -p
760 changeset: 21:38ec577f126b
761 changeset: 21:38ec577f126b
761 tag: tip
762 tag: tip
762 user: test
763 user: test
763 date: Thu Jan 01 00:00:19 1970 +0000
764 date: Thu Jan 01 00:00:19 1970 +0000
764 summary: y
765 summary: y
765
766
766 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
767 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
767 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
768 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
768 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
769 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
769 @@ -1,1 +1,2 @@
770 @@ -1,1 +1,2 @@
770 a
771 a
771 +a
772 +a
772
773
773
774
774 Preserve chmod +x
775 Preserve chmod +x
775
776
776 $ chmod +x f1
777 $ chmod +x f1
777 $ echo a >> f1
778 $ echo a >> f1
778 $ hg record -d '20 0' -mz <<EOF
779 $ hg record -d '20 0' -mz <<EOF
779 > y
780 > y
780 > y
781 > y
781 > y
782 > y
782 > EOF
783 > EOF
783 diff --git a/subdir/f1 b/subdir/f1
784 diff --git a/subdir/f1 b/subdir/f1
784 old mode 100644
785 old mode 100644
785 new mode 100755
786 new mode 100755
786 1 hunks, 1 lines changed
787 1 hunks, 1 lines changed
787 examine changes to 'subdir/f1'? [Ynsfdaq?]
788 examine changes to 'subdir/f1'? [Ynesfdaq?]
788 @@ -1,2 +1,3 @@
789 @@ -1,2 +1,3 @@
789 a
790 a
790 a
791 a
791 +a
792 +a
792 record this change to 'subdir/f1'? [Ynsfdaq?]
793 record this change to 'subdir/f1'? [Ynesfdaq?]
793
794
794 $ hg tip --config diff.git=True -p
795 $ hg tip --config diff.git=True -p
795 changeset: 22:3261adceb075
796 changeset: 22:3261adceb075
796 tag: tip
797 tag: tip
797 user: test
798 user: test
798 date: Thu Jan 01 00:00:20 1970 +0000
799 date: Thu Jan 01 00:00:20 1970 +0000
799 summary: z
800 summary: z
800
801
801 diff --git a/subdir/f1 b/subdir/f1
802 diff --git a/subdir/f1 b/subdir/f1
802 old mode 100644
803 old mode 100644
803 new mode 100755
804 new mode 100755
804 --- a/subdir/f1
805 --- a/subdir/f1
805 +++ b/subdir/f1
806 +++ b/subdir/f1
806 @@ -1,2 +1,3 @@
807 @@ -1,2 +1,3 @@
807 a
808 a
808 a
809 a
809 +a
810 +a
810
811
811
812
812 Preserve execute permission on original
813 Preserve execute permission on original
813
814
814 $ echo b >> f1
815 $ echo b >> f1
815 $ hg record -d '21 0' -maa <<EOF
816 $ hg record -d '21 0' -maa <<EOF
816 > y
817 > y
817 > y
818 > y
818 > y
819 > y
819 > EOF
820 > EOF
820 diff --git a/subdir/f1 b/subdir/f1
821 diff --git a/subdir/f1 b/subdir/f1
821 1 hunks, 1 lines changed
822 1 hunks, 1 lines changed
822 examine changes to 'subdir/f1'? [Ynsfdaq?]
823 examine changes to 'subdir/f1'? [Ynesfdaq?]
823 @@ -1,3 +1,4 @@
824 @@ -1,3 +1,4 @@
824 a
825 a
825 a
826 a
826 a
827 a
827 +b
828 +b
828 record this change to 'subdir/f1'? [Ynsfdaq?]
829 record this change to 'subdir/f1'? [Ynesfdaq?]
829
830
830 $ hg tip --config diff.git=True -p
831 $ hg tip --config diff.git=True -p
831 changeset: 23:b429867550db
832 changeset: 23:b429867550db
832 tag: tip
833 tag: tip
833 user: test
834 user: test
834 date: Thu Jan 01 00:00:21 1970 +0000
835 date: Thu Jan 01 00:00:21 1970 +0000
835 summary: aa
836 summary: aa
836
837
837 diff --git a/subdir/f1 b/subdir/f1
838 diff --git a/subdir/f1 b/subdir/f1
838 --- a/subdir/f1
839 --- a/subdir/f1
839 +++ b/subdir/f1
840 +++ b/subdir/f1
840 @@ -1,3 +1,4 @@
841 @@ -1,3 +1,4 @@
841 a
842 a
842 a
843 a
843 a
844 a
844 +b
845 +b
845
846
846
847
847 Preserve chmod -x
848 Preserve chmod -x
848
849
849 $ chmod -x f1
850 $ chmod -x f1
850 $ echo c >> f1
851 $ echo c >> f1
851 $ hg record -d '22 0' -mab <<EOF
852 $ hg record -d '22 0' -mab <<EOF
852 > y
853 > y
853 > y
854 > y
854 > y
855 > y
855 > EOF
856 > EOF
856 diff --git a/subdir/f1 b/subdir/f1
857 diff --git a/subdir/f1 b/subdir/f1
857 old mode 100755
858 old mode 100755
858 new mode 100644
859 new mode 100644
859 1 hunks, 1 lines changed
860 1 hunks, 1 lines changed
860 examine changes to 'subdir/f1'? [Ynsfdaq?]
861 examine changes to 'subdir/f1'? [Ynesfdaq?]
861 @@ -2,3 +2,4 @@
862 @@ -2,3 +2,4 @@
862 a
863 a
863 a
864 a
864 b
865 b
865 +c
866 +c
866 record this change to 'subdir/f1'? [Ynsfdaq?]
867 record this change to 'subdir/f1'? [Ynesfdaq?]
867
868
868 $ hg tip --config diff.git=True -p
869 $ hg tip --config diff.git=True -p
869 changeset: 24:0b082130c20a
870 changeset: 24:0b082130c20a
870 tag: tip
871 tag: tip
871 user: test
872 user: test
872 date: Thu Jan 01 00:00:22 1970 +0000
873 date: Thu Jan 01 00:00:22 1970 +0000
873 summary: ab
874 summary: ab
874
875
875 diff --git a/subdir/f1 b/subdir/f1
876 diff --git a/subdir/f1 b/subdir/f1
876 old mode 100755
877 old mode 100755
877 new mode 100644
878 new mode 100644
878 --- a/subdir/f1
879 --- a/subdir/f1
879 +++ b/subdir/f1
880 +++ b/subdir/f1
880 @@ -2,3 +2,4 @@
881 @@ -2,3 +2,4 @@
881 a
882 a
882 a
883 a
883 b
884 b
884 +c
885 +c
885
886
886
887
887 $ cd ..
888 $ cd ..
888
889
889 Abort early when a merge is in progress
890 Abort early when a merge is in progress
890
891
891 $ hg up 4
892 $ hg up 4
892 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
893 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
893
894
894 $ touch iwillmergethat
895 $ touch iwillmergethat
895 $ hg add iwillmergethat
896 $ hg add iwillmergethat
896
897
897 $ hg branch thatbranch
898 $ hg branch thatbranch
898 marked working directory as branch thatbranch
899 marked working directory as branch thatbranch
899 (branches are permanent and global, did you want a bookmark?)
900 (branches are permanent and global, did you want a bookmark?)
900
901
901 $ hg ci -m'new head'
902 $ hg ci -m'new head'
902
903
903 $ hg up default
904 $ hg up default
904 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
905 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
905
906
906 $ hg merge thatbranch
907 $ hg merge thatbranch
907 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
908 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
908 (branch merge, don't forget to commit)
909 (branch merge, don't forget to commit)
909
910
910 $ hg record -m'will abort'
911 $ hg record -m'will abort'
911 abort: cannot partially commit a merge (use "hg commit" instead)
912 abort: cannot partially commit a merge (use "hg commit" instead)
912 [255]
913 [255]
913
914
914 $ hg up -C
915 $ hg up -C
915 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
916
917
918 Editing patch
919
920 $ cat > editor << '__EOF__'
921 > #!/bin/sh
922 > sed -i -e 7d -e '5s/^-/ /' "$1"
923 > __EOF__
924 $ chmod +x editor
925 $ cat > editedfile << '__EOF__'
926 > This is the first line
927 > This is the second line
928 > This is the third line
929 > __EOF__
930 $ hg add editedfile
931 $ hg commit -medit-patch-1
932 $ cat > editedfile << '__EOF__'
933 > This line has changed
934 > This change will be committed
935 > This is the third line
936 > __EOF__
937 $ HGEDITOR="'`pwd`'"/editor hg record -d '23 0' -medit-patch-2 <<EOF
938 > y
939 > e
940 > EOF
941 diff --git a/editedfile b/editedfile
942 1 hunks, 2 lines changed
943 examine changes to 'editedfile'? [Ynesfdaq?]
944 @@ -1,3 +1,3 @@
945 -This is the first line
946 -This is the second line
947 +This line has changed
948 +This change will be committed
949 This is the third line
950 record this change to 'editedfile'? [Ynesfdaq?]
951 $ cat editedfile
952 This line has changed
953 This change will be committed
954 This is the third line
955 $ hg cat -r tip editedfile
956 This is the first line
957 This change will be committed
958 This is the third line
959 $ hg revert editedfile
960
961 Trying to edit patch for whole file
962
963 $ echo "This is the fourth line" >> editedfile
964 $ hg record <<EOF
965 > e
966 > q
967 > EOF
968 diff --git a/editedfile b/editedfile
969 1 hunks, 1 lines changed
970 examine changes to 'editedfile'? [Ynesfdaq?]
971 cannot edit patch for whole file
972 examine changes to 'editedfile'? [Ynesfdaq?]
973 abort: user quit
974 [255]
975 $ hg revert editedfile
976
977 Removing changes from patch
978
979 $ sed -i -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile
980 $ echo "This line has been added" >> editedfile
981 $ cat > editor << '__EOF__'
982 > #!/bin/sh
983 > sed -i -e 's/^[-+]/ /' "$1"
984 > __EOF__
985 $ chmod +x editor
986 $ HGEDITOR="'`pwd`'"/editor hg record <<EOF
987 > y
988 > e
989 > EOF
990 diff --git a/editedfile b/editedfile
991 1 hunks, 3 lines changed
992 examine changes to 'editedfile'? [Ynesfdaq?]
993 @@ -1,3 +1,3 @@
994 -This is the first line
995 -This change will be committed
996 -This is the third line
997 +This change will not be committed
998 +This is the second line
999 +This line has been added
1000 record this change to 'editedfile'? [Ynesfdaq?]
1001 no changes to record
1002 $ cat editedfile
1003 This change will not be committed
1004 This is the second line
1005 This line has been added
1006 $ hg cat -r tip editedfile
1007 This is the first line
1008 This change will be committed
1009 This is the third line
1010 $ hg revert editedfile
1011
1012 Invalid patch
1013
1014 $ sed -i -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile
1015 $ echo "This line has been added" >> editedfile
1016 $ cat > editor << '__EOF__'
1017 > #!/bin/sh
1018 > sed -i s/This/That/ "$1"
1019 > __EOF__
1020 $ chmod +x editor
1021 $ HGEDITOR="'`pwd`'"/editor hg record <<EOF
1022 > y
1023 > e
1024 > EOF
1025 diff --git a/editedfile b/editedfile
1026 1 hunks, 3 lines changed
1027 examine changes to 'editedfile'? [Ynesfdaq?]
1028 @@ -1,3 +1,3 @@
1029 -This is the first line
1030 -This change will be committed
1031 -This is the third line
1032 +This change will not be committed
1033 +This is the second line
1034 +This line has been added
1035 record this change to 'editedfile'? [Ynesfdaq?]
1036 patching file editedfile
1037 Hunk #1 FAILED at 0
1038 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej
1039 abort: patch failed to apply
1040 [255]
1041 $ cat editedfile
1042 This change will not be committed
1043 This is the second line
1044 This line has been added
1045 $ hg cat -r tip editedfile
1046 This is the first line
1047 This change will be committed
1048 This is the third line
1049 $ cat editedfile.rej
1050 --- editedfile
1051 +++ editedfile
1052 @@ -1,3 +1,3 @@
1053 -That is the first line
1054 -That change will be committed
1055 -That is the third line
1056 +That change will not be committed
1057 +That is the second line
1058 +That line has been added
1059 $ hg up -C
1060 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1061
917 With win32text
1062 With win32text
918
1063
919 $ echo '[extensions]' >> .hg/hgrc
1064 $ echo '[extensions]' >> .hg/hgrc
920 $ echo 'win32text = ' >> .hg/hgrc
1065 $ echo 'win32text = ' >> .hg/hgrc
921 $ echo '[decode]' >> .hg/hgrc
1066 $ echo '[decode]' >> .hg/hgrc
922 $ echo '** = cleverdecode:' >> .hg/hgrc
1067 $ echo '** = cleverdecode:' >> .hg/hgrc
923 $ echo '[encode]' >> .hg/hgrc
1068 $ echo '[encode]' >> .hg/hgrc
924 $ echo '** = cleverencode:' >> .hg/hgrc
1069 $ echo '** = cleverencode:' >> .hg/hgrc
925 $ echo '[patch]' >> .hg/hgrc
1070 $ echo '[patch]' >> .hg/hgrc
926 $ echo 'eol = crlf' >> .hg/hgrc
1071 $ echo 'eol = crlf' >> .hg/hgrc
927
1072
928 Ignore win32text deprecation warning for now:
1073 Ignore win32text deprecation warning for now:
929
1074
930 $ echo '[win32text]' >> .hg/hgrc
1075 $ echo '[win32text]' >> .hg/hgrc
931 $ echo 'warn = no' >> .hg/hgrc
1076 $ echo 'warn = no' >> .hg/hgrc
932
1077
933 $ echo d >> subdir/f1
1078 $ echo d >> subdir/f1
934 $ hg record -d '23 0' -mw1 <<EOF
1079 $ hg record -d '24 0' -mw1 <<EOF
935 > y
1080 > y
936 > y
1081 > y
937 > EOF
1082 > EOF
938 diff --git a/subdir/f1 b/subdir/f1
1083 diff --git a/subdir/f1 b/subdir/f1
939 1 hunks, 1 lines changed
1084 1 hunks, 1 lines changed
940 examine changes to 'subdir/f1'? [Ynsfdaq?]
1085 examine changes to 'subdir/f1'? [Ynesfdaq?]
941 @@ -3,3 +3,4 @@
1086 @@ -3,3 +3,4 @@
942 a
1087 a
943 b
1088 b
944 c
1089 c
945 +d
1090 +d
946 record this change to 'subdir/f1'? [Ynsfdaq?]
1091 record this change to 'subdir/f1'? [Ynesfdaq?]
947
1092
948 $ hg tip -p
1093 $ hg tip -p
949 changeset: 26:b8306e70edc4
1094 changeset: 28:287ad1f41a72
950 tag: tip
1095 tag: tip
951 parent: 24:0b082130c20a
952 user: test
1096 user: test
953 date: Thu Jan 01 00:00:23 1970 +0000
1097 date: Thu Jan 01 00:00:24 1970 +0000
954 summary: w1
1098 summary: w1
955
1099
956 diff -r 0b082130c20a -r b8306e70edc4 subdir/f1
1100 diff -r 65ce23a81197 -r 287ad1f41a72 subdir/f1
957 --- a/subdir/f1 Thu Jan 01 00:00:22 1970 +0000
1101 --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
958 +++ b/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
1102 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000
959 @@ -3,3 +3,4 @@
1103 @@ -3,3 +3,4 @@
960 a
1104 a
961 b
1105 b
962 c
1106 c
963 +d
1107 +d
964
1108
General Comments 0
You need to be logged in to leave comments. Login now