##// END OF EJS Templates
record: do not include files into changes count...
Patrick Mezard -
r13295:fb446228 default
parent child Browse files
Show More
@@ -1,555 +1,552
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 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
15 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
16
16
17 def scanpatch(fp):
17 def scanpatch(fp):
18 """like patch.iterhunks, but yield different events
18 """like patch.iterhunks, but yield different events
19
19
20 - ('file', [header_lines + fromfile + tofile])
20 - ('file', [header_lines + fromfile + tofile])
21 - ('context', [context_lines])
21 - ('context', [context_lines])
22 - ('hunk', [hunk_lines])
22 - ('hunk', [hunk_lines])
23 - ('range', (-start,len, +start,len, diffp))
23 - ('range', (-start,len, +start,len, diffp))
24 """
24 """
25 lr = patch.linereader(fp)
25 lr = patch.linereader(fp)
26
26
27 def scanwhile(first, p):
27 def scanwhile(first, p):
28 """scan lr while predicate holds"""
28 """scan lr while predicate holds"""
29 lines = [first]
29 lines = [first]
30 while True:
30 while True:
31 line = lr.readline()
31 line = lr.readline()
32 if not line:
32 if not line:
33 break
33 break
34 if p(line):
34 if p(line):
35 lines.append(line)
35 lines.append(line)
36 else:
36 else:
37 lr.push(line)
37 lr.push(line)
38 break
38 break
39 return lines
39 return lines
40
40
41 while True:
41 while True:
42 line = lr.readline()
42 line = lr.readline()
43 if not line:
43 if not line:
44 break
44 break
45 if line.startswith('diff --git a/') or line.startswith('diff -r '):
45 if line.startswith('diff --git a/') or line.startswith('diff -r '):
46 def notheader(line):
46 def notheader(line):
47 s = line.split(None, 1)
47 s = line.split(None, 1)
48 return not s or s[0] not in ('---', 'diff')
48 return not s or s[0] not in ('---', 'diff')
49 header = scanwhile(line, notheader)
49 header = scanwhile(line, notheader)
50 fromfile = lr.readline()
50 fromfile = lr.readline()
51 if fromfile.startswith('---'):
51 if fromfile.startswith('---'):
52 tofile = lr.readline()
52 tofile = lr.readline()
53 header += [fromfile, tofile]
53 header += [fromfile, tofile]
54 else:
54 else:
55 lr.push(fromfile)
55 lr.push(fromfile)
56 yield 'file', header
56 yield 'file', header
57 elif line[0] == ' ':
57 elif line[0] == ' ':
58 yield 'context', scanwhile(line, lambda l: l[0] in ' \\')
58 yield 'context', scanwhile(line, lambda l: l[0] in ' \\')
59 elif line[0] in '-+':
59 elif line[0] in '-+':
60 yield 'hunk', scanwhile(line, lambda l: l[0] in '-+\\')
60 yield 'hunk', scanwhile(line, lambda l: l[0] in '-+\\')
61 else:
61 else:
62 m = lines_re.match(line)
62 m = lines_re.match(line)
63 if m:
63 if m:
64 yield 'range', m.groups()
64 yield 'range', m.groups()
65 else:
65 else:
66 raise patch.PatchError('unknown patch content: %r' % line)
66 raise patch.PatchError('unknown patch content: %r' % line)
67
67
68 class header(object):
68 class header(object):
69 """patch header
69 """patch header
70
70
71 XXX shoudn't we move this to mercurial/patch.py ?
71 XXX shoudn't we move this to mercurial/patch.py ?
72 """
72 """
73 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
73 diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
74 diff_re = re.compile('diff -r .* (.*)$')
74 diff_re = re.compile('diff -r .* (.*)$')
75 allhunks_re = re.compile('(?:index|new file|deleted file) ')
75 allhunks_re = re.compile('(?:index|new file|deleted file) ')
76 pretty_re = re.compile('(?:new file|deleted file) ')
76 pretty_re = re.compile('(?:new file|deleted file) ')
77 special_re = re.compile('(?:index|new|deleted|copy|rename) ')
77 special_re = re.compile('(?:index|new|deleted|copy|rename) ')
78
78
79 def __init__(self, header):
79 def __init__(self, header):
80 self.header = header
80 self.header = header
81 self.hunks = []
81 self.hunks = []
82
82
83 def binary(self):
83 def binary(self):
84 return util.any(h.startswith('index ') for h in self.header)
84 return util.any(h.startswith('index ') for h in self.header)
85
85
86 def pretty(self, fp):
86 def pretty(self, fp):
87 for h in self.header:
87 for h in self.header:
88 if h.startswith('index '):
88 if h.startswith('index '):
89 fp.write(_('this modifies a binary file (all or nothing)\n'))
89 fp.write(_('this modifies a binary file (all or nothing)\n'))
90 break
90 break
91 if self.pretty_re.match(h):
91 if self.pretty_re.match(h):
92 fp.write(h)
92 fp.write(h)
93 if self.binary():
93 if self.binary():
94 fp.write(_('this is a binary file\n'))
94 fp.write(_('this is a binary file\n'))
95 break
95 break
96 if h.startswith('---'):
96 if h.startswith('---'):
97 fp.write(_('%d hunks, %d lines changed\n') %
97 fp.write(_('%d hunks, %d lines changed\n') %
98 (len(self.hunks),
98 (len(self.hunks),
99 sum([max(h.added, h.removed) for h in self.hunks])))
99 sum([max(h.added, h.removed) for h in self.hunks])))
100 break
100 break
101 fp.write(h)
101 fp.write(h)
102
102
103 def write(self, fp):
103 def write(self, fp):
104 fp.write(''.join(self.header))
104 fp.write(''.join(self.header))
105
105
106 def allhunks(self):
106 def allhunks(self):
107 return util.any(self.allhunks_re.match(h) for h in self.header)
107 return util.any(self.allhunks_re.match(h) for h in self.header)
108
108
109 def files(self):
109 def files(self):
110 match = self.diffgit_re.match(self.header[0])
110 match = self.diffgit_re.match(self.header[0])
111 if match:
111 if match:
112 fromfile, tofile = match.groups()
112 fromfile, tofile = match.groups()
113 if fromfile == tofile:
113 if fromfile == tofile:
114 return [fromfile]
114 return [fromfile]
115 return [fromfile, tofile]
115 return [fromfile, tofile]
116 else:
116 else:
117 return self.diff_re.match(self.header[0]).groups()
117 return self.diff_re.match(self.header[0]).groups()
118
118
119 def filename(self):
119 def filename(self):
120 return self.files()[-1]
120 return self.files()[-1]
121
121
122 def __repr__(self):
122 def __repr__(self):
123 return '<header %s>' % (' '.join(map(repr, self.files())))
123 return '<header %s>' % (' '.join(map(repr, self.files())))
124
124
125 def special(self):
125 def special(self):
126 return util.any(self.special_re.match(h) for h in self.header)
126 return util.any(self.special_re.match(h) for h in self.header)
127
127
128 def countchanges(hunk):
128 def countchanges(hunk):
129 """hunk -> (n+,n-)"""
129 """hunk -> (n+,n-)"""
130 add = len([h for h in hunk if h[0] == '+'])
130 add = len([h for h in hunk if h[0] == '+'])
131 rem = len([h for h in hunk if h[0] == '-'])
131 rem = len([h for h in hunk if h[0] == '-'])
132 return add, rem
132 return add, rem
133
133
134 class hunk(object):
134 class hunk(object):
135 """patch hunk
135 """patch hunk
136
136
137 XXX shouldn't we merge this with patch.hunk ?
137 XXX shouldn't we merge this with patch.hunk ?
138 """
138 """
139 maxcontext = 3
139 maxcontext = 3
140
140
141 def __init__(self, header, fromline, toline, proc, before, hunk, after):
141 def __init__(self, header, fromline, toline, proc, before, hunk, after):
142 def trimcontext(number, lines):
142 def trimcontext(number, lines):
143 delta = len(lines) - self.maxcontext
143 delta = len(lines) - self.maxcontext
144 if False and delta > 0:
144 if False and delta > 0:
145 return number + delta, lines[:self.maxcontext]
145 return number + delta, lines[:self.maxcontext]
146 return number, lines
146 return number, lines
147
147
148 self.header = header
148 self.header = header
149 self.fromline, self.before = trimcontext(fromline, before)
149 self.fromline, self.before = trimcontext(fromline, before)
150 self.toline, self.after = trimcontext(toline, after)
150 self.toline, self.after = trimcontext(toline, after)
151 self.proc = proc
151 self.proc = proc
152 self.hunk = hunk
152 self.hunk = hunk
153 self.added, self.removed = countchanges(self.hunk)
153 self.added, self.removed = countchanges(self.hunk)
154
154
155 def write(self, fp):
155 def write(self, fp):
156 delta = len(self.before) + len(self.after)
156 delta = len(self.before) + len(self.after)
157 if self.after and self.after[-1] == '\\ No newline at end of file\n':
157 if self.after and self.after[-1] == '\\ No newline at end of file\n':
158 delta -= 1
158 delta -= 1
159 fromlen = delta + self.removed
159 fromlen = delta + self.removed
160 tolen = delta + self.added
160 tolen = delta + self.added
161 fp.write('@@ -%d,%d +%d,%d @@%s\n' %
161 fp.write('@@ -%d,%d +%d,%d @@%s\n' %
162 (self.fromline, fromlen, self.toline, tolen,
162 (self.fromline, fromlen, self.toline, tolen,
163 self.proc and (' ' + self.proc)))
163 self.proc and (' ' + self.proc)))
164 fp.write(''.join(self.before + self.hunk + self.after))
164 fp.write(''.join(self.before + self.hunk + self.after))
165
165
166 pretty = write
166 pretty = write
167
167
168 def filename(self):
168 def filename(self):
169 return self.header.filename()
169 return self.header.filename()
170
170
171 def __repr__(self):
171 def __repr__(self):
172 return '<hunk %r@%d>' % (self.filename(), self.fromline)
172 return '<hunk %r@%d>' % (self.filename(), self.fromline)
173
173
174 def parsepatch(fp):
174 def parsepatch(fp):
175 """patch -> [] of headers -> [] of hunks """
175 """patch -> [] of headers -> [] of hunks """
176 class parser(object):
176 class parser(object):
177 """patch parsing state machine"""
177 """patch parsing state machine"""
178 def __init__(self):
178 def __init__(self):
179 self.fromline = 0
179 self.fromline = 0
180 self.toline = 0
180 self.toline = 0
181 self.proc = ''
181 self.proc = ''
182 self.header = None
182 self.header = None
183 self.context = []
183 self.context = []
184 self.before = []
184 self.before = []
185 self.hunk = []
185 self.hunk = []
186 self.headers = []
186 self.headers = []
187
187
188 def addrange(self, limits):
188 def addrange(self, limits):
189 fromstart, fromend, tostart, toend, proc = limits
189 fromstart, fromend, tostart, toend, proc = limits
190 self.fromline = int(fromstart)
190 self.fromline = int(fromstart)
191 self.toline = int(tostart)
191 self.toline = int(tostart)
192 self.proc = proc
192 self.proc = proc
193
193
194 def addcontext(self, context):
194 def addcontext(self, context):
195 if self.hunk:
195 if self.hunk:
196 h = hunk(self.header, self.fromline, self.toline, self.proc,
196 h = hunk(self.header, self.fromline, self.toline, self.proc,
197 self.before, self.hunk, context)
197 self.before, self.hunk, context)
198 self.header.hunks.append(h)
198 self.header.hunks.append(h)
199 self.fromline += len(self.before) + h.removed
199 self.fromline += len(self.before) + h.removed
200 self.toline += len(self.before) + h.added
200 self.toline += len(self.before) + h.added
201 self.before = []
201 self.before = []
202 self.hunk = []
202 self.hunk = []
203 self.proc = ''
203 self.proc = ''
204 self.context = context
204 self.context = context
205
205
206 def addhunk(self, hunk):
206 def addhunk(self, hunk):
207 if self.context:
207 if self.context:
208 self.before = self.context
208 self.before = self.context
209 self.context = []
209 self.context = []
210 self.hunk = hunk
210 self.hunk = hunk
211
211
212 def newfile(self, hdr):
212 def newfile(self, hdr):
213 self.addcontext([])
213 self.addcontext([])
214 h = header(hdr)
214 h = header(hdr)
215 self.headers.append(h)
215 self.headers.append(h)
216 self.header = h
216 self.header = h
217
217
218 def finished(self):
218 def finished(self):
219 self.addcontext([])
219 self.addcontext([])
220 return self.headers
220 return self.headers
221
221
222 transitions = {
222 transitions = {
223 'file': {'context': addcontext,
223 'file': {'context': addcontext,
224 'file': newfile,
224 'file': newfile,
225 'hunk': addhunk,
225 'hunk': addhunk,
226 'range': addrange},
226 'range': addrange},
227 'context': {'file': newfile,
227 'context': {'file': newfile,
228 'hunk': addhunk,
228 'hunk': addhunk,
229 'range': addrange},
229 'range': addrange},
230 'hunk': {'context': addcontext,
230 'hunk': {'context': addcontext,
231 'file': newfile,
231 'file': newfile,
232 'range': addrange},
232 'range': addrange},
233 'range': {'context': addcontext,
233 'range': {'context': addcontext,
234 'hunk': addhunk},
234 'hunk': addhunk},
235 }
235 }
236
236
237 p = parser()
237 p = parser()
238
238
239 state = 'context'
239 state = 'context'
240 for newstate, data in scanpatch(fp):
240 for newstate, data in scanpatch(fp):
241 try:
241 try:
242 p.transitions[state][newstate](p, data)
242 p.transitions[state][newstate](p, data)
243 except KeyError:
243 except KeyError:
244 raise patch.PatchError('unhandled transition: %s -> %s' %
244 raise patch.PatchError('unhandled transition: %s -> %s' %
245 (state, newstate))
245 (state, newstate))
246 state = newstate
246 state = newstate
247 return p.finished()
247 return p.finished()
248
248
249 def filterpatch(ui, headers):
249 def filterpatch(ui, headers):
250 """Interactively filter patch chunks into applied-only chunks"""
250 """Interactively filter patch chunks into applied-only chunks"""
251
251
252 def prompt(skipfile, skipall, query):
252 def prompt(skipfile, skipall, query):
253 """prompt query, and process base inputs
253 """prompt query, and process base inputs
254
254
255 - y/n for the rest of file
255 - y/n for the rest of file
256 - y/n for the rest
256 - y/n for the rest
257 - ? (help)
257 - ? (help)
258 - q (quit)
258 - q (quit)
259
259
260 Return True/False and possibly updated skipfile and skipall.
260 Return True/False and possibly updated skipfile and skipall.
261 """
261 """
262 if skipall is not None:
262 if skipall is not None:
263 return skipall, skipfile, skipall
263 return skipall, skipfile, skipall
264 if skipfile is not None:
264 if skipfile is not None:
265 return skipfile, skipfile, skipall
265 return skipfile, skipfile, skipall
266 while True:
266 while True:
267 resps = _('[Ynsfdaq?]')
267 resps = _('[Ynsfdaq?]')
268 choices = (_('&Yes, record this change'),
268 choices = (_('&Yes, record this change'),
269 _('&No, skip this change'),
269 _('&No, skip this change'),
270 _('&Skip remaining changes to this file'),
270 _('&Skip remaining changes to this file'),
271 _('Record remaining changes to this &file'),
271 _('Record remaining changes to this &file'),
272 _('&Done, skip remaining changes and files'),
272 _('&Done, skip remaining changes and files'),
273 _('Record &all changes to all remaining files'),
273 _('Record &all changes to all remaining files'),
274 _('&Quit, recording no changes'),
274 _('&Quit, recording no changes'),
275 _('&?'))
275 _('&?'))
276 r = ui.promptchoice("%s %s" % (query, resps), choices)
276 r = ui.promptchoice("%s %s" % (query, resps), choices)
277 ui.write("\n")
277 ui.write("\n")
278 if r == 7: # ?
278 if r == 7: # ?
279 doc = gettext(record.__doc__)
279 doc = gettext(record.__doc__)
280 c = doc.find('::') + 2
280 c = doc.find('::') + 2
281 for l in doc[c:].splitlines():
281 for l in doc[c:].splitlines():
282 if l.startswith(' '):
282 if l.startswith(' '):
283 ui.write(l.strip(), '\n')
283 ui.write(l.strip(), '\n')
284 continue
284 continue
285 elif r == 0: # yes
285 elif r == 0: # yes
286 ret = True
286 ret = True
287 elif r == 1: # no
287 elif r == 1: # no
288 ret = False
288 ret = False
289 elif r == 2: # Skip
289 elif r == 2: # Skip
290 ret = skipfile = False
290 ret = skipfile = False
291 elif r == 3: # file (Record remaining)
291 elif r == 3: # file (Record remaining)
292 ret = skipfile = True
292 ret = skipfile = True
293 elif r == 4: # done, skip remaining
293 elif r == 4: # done, skip remaining
294 ret = skipall = False
294 ret = skipall = False
295 elif r == 5: # all
295 elif r == 5: # all
296 ret = skipall = True
296 ret = skipall = True
297 elif r == 6: # quit
297 elif r == 6: # quit
298 raise util.Abort(_('user quit'))
298 raise util.Abort(_('user quit'))
299 return ret, skipfile, skipall
299 return ret, skipfile, skipall
300
300
301 seen = set()
301 seen = set()
302 applied = {} # 'filename' -> [] of chunks
302 applied = {} # 'filename' -> [] of chunks
303 skipfile, skipall = None, None
303 skipfile, skipall = None, None
304 # XXX: operation count is weird: it counts headers and hunks
304 pos, total = 1, sum(len(h.hunks) for h in headers)
305 # except for the first header. It probably comes from the previous
306 # mixed header/hunk stream representation.
307 pos, total = -1, sum((len(h.hunks) + 1) for h in headers) - 1
308 for h in headers:
305 for h in headers:
309 pos += len(h.hunks) + 1
306 pos += len(h.hunks)
310 skipfile = None
307 skipfile = None
311 fixoffset = 0
308 fixoffset = 0
312 hdr = ''.join(h.header)
309 hdr = ''.join(h.header)
313 if hdr in seen:
310 if hdr in seen:
314 continue
311 continue
315 seen.add(hdr)
312 seen.add(hdr)
316 if skipall is None:
313 if skipall is None:
317 h.pretty(ui)
314 h.pretty(ui)
318 msg = (_('examine changes to %s?') %
315 msg = (_('examine changes to %s?') %
319 _(' and ').join(map(repr, h.files())))
316 _(' and ').join(map(repr, h.files())))
320 r, skipfile, skipall = prompt(skipfile, skipall, msg)
317 r, skipfile, skipall = prompt(skipfile, skipall, msg)
321 if not r:
318 if not r:
322 continue
319 continue
323 applied[h.filename()] = [h]
320 applied[h.filename()] = [h]
324 if h.allhunks():
321 if h.allhunks():
325 applied[h.filename()] += h.hunks
322 applied[h.filename()] += h.hunks
326 continue
323 continue
327 for i, chunk in enumerate(h.hunks):
324 for i, chunk in enumerate(h.hunks):
328 if skipfile is None and skipall is None:
325 if skipfile is None and skipall is None:
329 chunk.pretty(ui)
326 chunk.pretty(ui)
330 msg = (total == 1
327 msg = (total == 1
331 and (_('record this change to %r?') % chunk.filename())
328 and (_('record this change to %r?') % chunk.filename())
332 or (_('record change %d/%d to %r?') %
329 or (_('record change %d/%d to %r?') %
333 (pos - len(h.hunks) + i + 1, total, chunk.filename())))
330 (pos - len(h.hunks) + i, total, chunk.filename())))
334 r, skipfile, skipall = prompt(skipfile, skipall, msg)
331 r, skipfile, skipall = prompt(skipfile, skipall, msg)
335 if r:
332 if r:
336 if fixoffset:
333 if fixoffset:
337 chunk = copy.copy(chunk)
334 chunk = copy.copy(chunk)
338 chunk.toline += fixoffset
335 chunk.toline += fixoffset
339 applied[chunk.filename()].append(chunk)
336 applied[chunk.filename()].append(chunk)
340 else:
337 else:
341 fixoffset += chunk.removed - chunk.added
338 fixoffset += chunk.removed - chunk.added
342 return sum([h for h in applied.itervalues()
339 return sum([h for h in applied.itervalues()
343 if h[0].special() or len(h) > 1], [])
340 if h[0].special() or len(h) > 1], [])
344
341
345 def record(ui, repo, *pats, **opts):
342 def record(ui, repo, *pats, **opts):
346 '''interactively select changes to commit
343 '''interactively select changes to commit
347
344
348 If a list of files is omitted, all changes reported by :hg:`status`
345 If a list of files is omitted, all changes reported by :hg:`status`
349 will be candidates for recording.
346 will be candidates for recording.
350
347
351 See :hg:`help dates` for a list of formats valid for -d/--date.
348 See :hg:`help dates` for a list of formats valid for -d/--date.
352
349
353 You will be prompted for whether to record changes to each
350 You will be prompted for whether to record changes to each
354 modified file, and for files with multiple changes, for each
351 modified file, and for files with multiple changes, for each
355 change to use. For each query, the following responses are
352 change to use. For each query, the following responses are
356 possible::
353 possible::
357
354
358 y - record this change
355 y - record this change
359 n - skip this change
356 n - skip this change
360
357
361 s - skip remaining changes to this file
358 s - skip remaining changes to this file
362 f - record remaining changes to this file
359 f - record remaining changes to this file
363
360
364 d - done, skip remaining changes and files
361 d - done, skip remaining changes and files
365 a - record all changes to all remaining files
362 a - record all changes to all remaining files
366 q - quit, recording no changes
363 q - quit, recording no changes
367
364
368 ? - display help
365 ? - display help
369
366
370 This command is not available when committing a merge.'''
367 This command is not available when committing a merge.'''
371
368
372 dorecord(ui, repo, commands.commit, *pats, **opts)
369 dorecord(ui, repo, commands.commit, *pats, **opts)
373
370
374
371
375 def qrecord(ui, repo, patch, *pats, **opts):
372 def qrecord(ui, repo, patch, *pats, **opts):
376 '''interactively record a new patch
373 '''interactively record a new patch
377
374
378 See :hg:`help qnew` & :hg:`help record` for more information and
375 See :hg:`help qnew` & :hg:`help record` for more information and
379 usage.
376 usage.
380 '''
377 '''
381
378
382 try:
379 try:
383 mq = extensions.find('mq')
380 mq = extensions.find('mq')
384 except KeyError:
381 except KeyError:
385 raise util.Abort(_("'mq' extension not loaded"))
382 raise util.Abort(_("'mq' extension not loaded"))
386
383
387 def committomq(ui, repo, *pats, **opts):
384 def committomq(ui, repo, *pats, **opts):
388 mq.new(ui, repo, patch, *pats, **opts)
385 mq.new(ui, repo, patch, *pats, **opts)
389
386
390 dorecord(ui, repo, committomq, *pats, **opts)
387 dorecord(ui, repo, committomq, *pats, **opts)
391
388
392
389
393 def dorecord(ui, repo, commitfunc, *pats, **opts):
390 def dorecord(ui, repo, commitfunc, *pats, **opts):
394 if not ui.interactive():
391 if not ui.interactive():
395 raise util.Abort(_('running non-interactively, use commit instead'))
392 raise util.Abort(_('running non-interactively, use commit instead'))
396
393
397 def recordfunc(ui, repo, message, match, opts):
394 def recordfunc(ui, repo, message, match, opts):
398 """This is generic record driver.
395 """This is generic record driver.
399
396
400 Its job is to interactively filter local changes, and
397 Its job is to interactively filter local changes, and
401 accordingly prepare working directory into a state in which the
398 accordingly prepare working directory into a state in which the
402 job can be delegated to a non-interactive commit command such as
399 job can be delegated to a non-interactive commit command such as
403 'commit' or 'qrefresh'.
400 'commit' or 'qrefresh'.
404
401
405 After the actual job is done by non-interactive command, the
402 After the actual job is done by non-interactive command, the
406 working directory is restored to its original state.
403 working directory is restored to its original state.
407
404
408 In the end we'll record interesting changes, and everything else
405 In the end we'll record interesting changes, and everything else
409 will be left in place, so the user can continue working.
406 will be left in place, so the user can continue working.
410 """
407 """
411
408
412 merge = len(repo[None].parents()) > 1
409 merge = len(repo[None].parents()) > 1
413 if merge:
410 if merge:
414 raise util.Abort(_('cannot partially commit a merge '
411 raise util.Abort(_('cannot partially commit a merge '
415 '(use "hg commit" instead)'))
412 '(use "hg commit" instead)'))
416
413
417 changes = repo.status(match=match)[:3]
414 changes = repo.status(match=match)[:3]
418 diffopts = mdiff.diffopts(git=True, nodates=True)
415 diffopts = mdiff.diffopts(git=True, nodates=True)
419 chunks = patch.diff(repo, changes=changes, opts=diffopts)
416 chunks = patch.diff(repo, changes=changes, opts=diffopts)
420 fp = cStringIO.StringIO()
417 fp = cStringIO.StringIO()
421 fp.write(''.join(chunks))
418 fp.write(''.join(chunks))
422 fp.seek(0)
419 fp.seek(0)
423
420
424 # 1. filter patch, so we have intending-to apply subset of it
421 # 1. filter patch, so we have intending-to apply subset of it
425 chunks = filterpatch(ui, parsepatch(fp))
422 chunks = filterpatch(ui, parsepatch(fp))
426 del fp
423 del fp
427
424
428 contenders = set()
425 contenders = set()
429 for h in chunks:
426 for h in chunks:
430 try:
427 try:
431 contenders.update(set(h.files()))
428 contenders.update(set(h.files()))
432 except AttributeError:
429 except AttributeError:
433 pass
430 pass
434
431
435 changed = changes[0] + changes[1] + changes[2]
432 changed = changes[0] + changes[1] + changes[2]
436 newfiles = [f for f in changed if f in contenders]
433 newfiles = [f for f in changed if f in contenders]
437 if not newfiles:
434 if not newfiles:
438 ui.status(_('no changes to record\n'))
435 ui.status(_('no changes to record\n'))
439 return 0
436 return 0
440
437
441 modified = set(changes[0])
438 modified = set(changes[0])
442
439
443 # 2. backup changed files, so we can restore them in the end
440 # 2. backup changed files, so we can restore them in the end
444 backups = {}
441 backups = {}
445 backupdir = repo.join('record-backups')
442 backupdir = repo.join('record-backups')
446 try:
443 try:
447 os.mkdir(backupdir)
444 os.mkdir(backupdir)
448 except OSError, err:
445 except OSError, err:
449 if err.errno != errno.EEXIST:
446 if err.errno != errno.EEXIST:
450 raise
447 raise
451 try:
448 try:
452 # backup continues
449 # backup continues
453 for f in newfiles:
450 for f in newfiles:
454 if f not in modified:
451 if f not in modified:
455 continue
452 continue
456 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
453 fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',
457 dir=backupdir)
454 dir=backupdir)
458 os.close(fd)
455 os.close(fd)
459 ui.debug('backup %r as %r\n' % (f, tmpname))
456 ui.debug('backup %r as %r\n' % (f, tmpname))
460 util.copyfile(repo.wjoin(f), tmpname)
457 util.copyfile(repo.wjoin(f), tmpname)
461 shutil.copystat(repo.wjoin(f), tmpname)
458 shutil.copystat(repo.wjoin(f), tmpname)
462 backups[f] = tmpname
459 backups[f] = tmpname
463
460
464 fp = cStringIO.StringIO()
461 fp = cStringIO.StringIO()
465 for c in chunks:
462 for c in chunks:
466 if c.filename() in backups:
463 if c.filename() in backups:
467 c.write(fp)
464 c.write(fp)
468 dopatch = fp.tell()
465 dopatch = fp.tell()
469 fp.seek(0)
466 fp.seek(0)
470
467
471 # 3a. apply filtered patch to clean repo (clean)
468 # 3a. apply filtered patch to clean repo (clean)
472 if backups:
469 if backups:
473 hg.revert(repo, repo.dirstate.parents()[0],
470 hg.revert(repo, repo.dirstate.parents()[0],
474 lambda key: key in backups)
471 lambda key: key in backups)
475
472
476 # 3b. (apply)
473 # 3b. (apply)
477 if dopatch:
474 if dopatch:
478 try:
475 try:
479 ui.debug('applying patch\n')
476 ui.debug('applying patch\n')
480 ui.debug(fp.getvalue())
477 ui.debug(fp.getvalue())
481 pfiles = {}
478 pfiles = {}
482 patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
479 patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
483 eolmode=None)
480 eolmode=None)
484 cmdutil.updatedir(ui, repo, pfiles)
481 cmdutil.updatedir(ui, repo, pfiles)
485 except patch.PatchError, err:
482 except patch.PatchError, err:
486 raise util.Abort(str(err))
483 raise util.Abort(str(err))
487 del fp
484 del fp
488
485
489 # 4. We prepared working directory according to filtered
486 # 4. We prepared working directory according to filtered
490 # patch. Now is the time to delegate the job to
487 # patch. Now is the time to delegate the job to
491 # commit/qrefresh or the like!
488 # commit/qrefresh or the like!
492
489
493 # it is important to first chdir to repo root -- we'll call
490 # it is important to first chdir to repo root -- we'll call
494 # a highlevel command with list of pathnames relative to
491 # a highlevel command with list of pathnames relative to
495 # repo root
492 # repo root
496 cwd = os.getcwd()
493 cwd = os.getcwd()
497 os.chdir(repo.root)
494 os.chdir(repo.root)
498 try:
495 try:
499 commitfunc(ui, repo, *newfiles, **opts)
496 commitfunc(ui, repo, *newfiles, **opts)
500 finally:
497 finally:
501 os.chdir(cwd)
498 os.chdir(cwd)
502
499
503 return 0
500 return 0
504 finally:
501 finally:
505 # 5. finally restore backed-up files
502 # 5. finally restore backed-up files
506 try:
503 try:
507 for realname, tmpname in backups.iteritems():
504 for realname, tmpname in backups.iteritems():
508 ui.debug('restoring %r to %r\n' % (tmpname, realname))
505 ui.debug('restoring %r to %r\n' % (tmpname, realname))
509 util.copyfile(tmpname, repo.wjoin(realname))
506 util.copyfile(tmpname, repo.wjoin(realname))
510 # Our calls to copystat() here and above are a
507 # Our calls to copystat() here and above are a
511 # hack to trick any editors that have f open that
508 # hack to trick any editors that have f open that
512 # we haven't modified them.
509 # we haven't modified them.
513 #
510 #
514 # Also note that this racy as an editor could
511 # Also note that this racy as an editor could
515 # notice the file's mtime before we've finished
512 # notice the file's mtime before we've finished
516 # writing it.
513 # writing it.
517 shutil.copystat(tmpname, repo.wjoin(realname))
514 shutil.copystat(tmpname, repo.wjoin(realname))
518 os.unlink(tmpname)
515 os.unlink(tmpname)
519 os.rmdir(backupdir)
516 os.rmdir(backupdir)
520 except OSError:
517 except OSError:
521 pass
518 pass
522
519
523 # wrap ui.write so diff output can be labeled/colorized
520 # wrap ui.write so diff output can be labeled/colorized
524 def wrapwrite(orig, *args, **kw):
521 def wrapwrite(orig, *args, **kw):
525 label = kw.pop('label', '')
522 label = kw.pop('label', '')
526 for chunk, l in patch.difflabel(lambda: args):
523 for chunk, l in patch.difflabel(lambda: args):
527 orig(chunk, label=label + l)
524 orig(chunk, label=label + l)
528 oldwrite = ui.write
525 oldwrite = ui.write
529 extensions.wrapfunction(ui, 'write', wrapwrite)
526 extensions.wrapfunction(ui, 'write', wrapwrite)
530 try:
527 try:
531 return cmdutil.commit(ui, repo, recordfunc, pats, opts)
528 return cmdutil.commit(ui, repo, recordfunc, pats, opts)
532 finally:
529 finally:
533 ui.write = oldwrite
530 ui.write = oldwrite
534
531
535 cmdtable = {
532 cmdtable = {
536 "record":
533 "record":
537 (record, commands.table['^commit|ci'][1], # same options as commit
534 (record, commands.table['^commit|ci'][1], # same options as commit
538 _('hg record [OPTION]... [FILE]...')),
535 _('hg record [OPTION]... [FILE]...')),
539 }
536 }
540
537
541
538
542 def uisetup(ui):
539 def uisetup(ui):
543 try:
540 try:
544 mq = extensions.find('mq')
541 mq = extensions.find('mq')
545 except KeyError:
542 except KeyError:
546 return
543 return
547
544
548 qcmdtable = {
545 qcmdtable = {
549 "qrecord":
546 "qrecord":
550 (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
547 (qrecord, mq.cmdtable['^qnew'][1], # same options as qnew
551 _('hg qrecord [OPTION]... PATCH [FILE]...')),
548 _('hg qrecord [OPTION]... PATCH [FILE]...')),
552 }
549 }
553
550
554 cmdtable.update(qcmdtable)
551 cmdtable.update(qcmdtable)
555
552
@@ -1,304 +1,304
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 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "record=" >> $HGRCPATH
6 $ echo "record=" >> $HGRCPATH
7
7
8 help (no mq, so no qrecord)
8 help (no mq, so no qrecord)
9
9
10 $ hg help qrecord
10 $ hg help qrecord
11 hg: unknown command 'qrecord'
11 hg: unknown command 'qrecord'
12 Mercurial Distributed SCM
12 Mercurial Distributed SCM
13
13
14 basic commands:
14 basic commands:
15
15
16 add add the specified files on the next commit
16 add add the specified files on the next commit
17 annotate show changeset information by line for each file
17 annotate show changeset information by line for each file
18 clone make a copy of an existing repository
18 clone make a copy of an existing repository
19 commit commit the specified files or all outstanding changes
19 commit commit the specified files or all outstanding changes
20 diff diff repository (or selected files)
20 diff diff repository (or selected files)
21 export dump the header and diffs for one or more changesets
21 export dump the header and diffs for one or more changesets
22 forget forget the specified files on the next commit
22 forget forget the specified files on the next commit
23 init create a new repository in the given directory
23 init create a new repository in the given directory
24 log show revision history of entire repository or files
24 log show revision history of entire repository or files
25 merge merge working directory with another revision
25 merge merge working directory with another revision
26 pull pull changes from the specified source
26 pull pull changes from the specified source
27 push push changes to the specified destination
27 push push changes to the specified destination
28 remove remove the specified files on the next commit
28 remove remove the specified files on the next commit
29 serve start stand-alone webserver
29 serve start stand-alone webserver
30 status show changed files in the working directory
30 status show changed files in the working directory
31 summary summarize working directory state
31 summary summarize working directory state
32 update update working directory (or switch revisions)
32 update update working directory (or switch revisions)
33
33
34 use "hg help" for the full list of commands or "hg -v" for details
34 use "hg help" for the full list of commands or "hg -v" for details
35 [255]
35 [255]
36
36
37 help (mq present)
37 help (mq present)
38
38
39 $ echo "mq=" >> $HGRCPATH
39 $ echo "mq=" >> $HGRCPATH
40 $ hg help qrecord
40 $ hg help qrecord
41 hg qrecord [OPTION]... PATCH [FILE]...
41 hg qrecord [OPTION]... PATCH [FILE]...
42
42
43 interactively record a new patch
43 interactively record a new patch
44
44
45 See "hg help qnew" & "hg help record" for more information and usage.
45 See "hg help qnew" & "hg help record" for more information and usage.
46
46
47 options:
47 options:
48
48
49 -e --edit edit commit message
49 -e --edit edit commit message
50 -g --git use git extended diff format
50 -g --git use git extended diff format
51 -U --currentuser add "From: <current user>" to patch
51 -U --currentuser add "From: <current user>" to patch
52 -u --user USER add "From: <USER>" to patch
52 -u --user USER add "From: <USER>" to patch
53 -D --currentdate add "Date: <current date>" to patch
53 -D --currentdate add "Date: <current date>" to patch
54 -d --date DATE add "Date: <DATE>" to patch
54 -d --date DATE add "Date: <DATE>" to patch
55 -I --include PATTERN [+] include names matching the given patterns
55 -I --include PATTERN [+] include names matching the given patterns
56 -X --exclude PATTERN [+] exclude names matching the given patterns
56 -X --exclude PATTERN [+] exclude names matching the given patterns
57 -m --message TEXT use text as commit message
57 -m --message TEXT use text as commit message
58 -l --logfile FILE read commit message from file
58 -l --logfile FILE read commit message from file
59
59
60 [+] marked option can be specified multiple times
60 [+] marked option can be specified multiple times
61
61
62 use "hg -v help qrecord" to show global options
62 use "hg -v help qrecord" to show global options
63
63
64 $ hg init a
64 $ hg init a
65 $ cd a
65 $ cd a
66
66
67 Base commit
67 Base commit
68
68
69 $ cat > 1.txt <<EOF
69 $ cat > 1.txt <<EOF
70 > 1
70 > 1
71 > 2
71 > 2
72 > 3
72 > 3
73 > 4
73 > 4
74 > 5
74 > 5
75 > EOF
75 > EOF
76 $ cat > 2.txt <<EOF
76 $ cat > 2.txt <<EOF
77 > a
77 > a
78 > b
78 > b
79 > c
79 > c
80 > d
80 > d
81 > e
81 > e
82 > f
82 > f
83 > EOF
83 > EOF
84
84
85 $ mkdir dir
85 $ mkdir dir
86 $ cat > dir/a.txt <<EOF
86 $ cat > dir/a.txt <<EOF
87 > hello world
87 > hello world
88 >
88 >
89 > someone
89 > someone
90 > up
90 > up
91 > there
91 > there
92 > loves
92 > loves
93 > me
93 > me
94 > EOF
94 > EOF
95
95
96 $ hg add 1.txt 2.txt dir/a.txt
96 $ hg add 1.txt 2.txt dir/a.txt
97 $ hg commit -m 'initial checkin'
97 $ hg commit -m 'initial checkin'
98
98
99 Changing files
99 Changing files
100
100
101 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
101 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
102 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
102 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
103 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
103 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
104
104
105 $ mv -f 1.txt.new 1.txt
105 $ mv -f 1.txt.new 1.txt
106 $ mv -f 2.txt.new 2.txt
106 $ mv -f 2.txt.new 2.txt
107 $ mv -f dir/a.txt.new dir/a.txt
107 $ mv -f dir/a.txt.new dir/a.txt
108
108
109 Whole diff
109 Whole diff
110
110
111 $ hg diff --nodates
111 $ hg diff --nodates
112 diff -r 1057167b20ef 1.txt
112 diff -r 1057167b20ef 1.txt
113 --- a/1.txt
113 --- a/1.txt
114 +++ b/1.txt
114 +++ b/1.txt
115 @@ -1,5 +1,5 @@
115 @@ -1,5 +1,5 @@
116 1
116 1
117 -2
117 -2
118 +2 2
118 +2 2
119 3
119 3
120 -4
120 -4
121 +4 4
121 +4 4
122 5
122 5
123 diff -r 1057167b20ef 2.txt
123 diff -r 1057167b20ef 2.txt
124 --- a/2.txt
124 --- a/2.txt
125 +++ b/2.txt
125 +++ b/2.txt
126 @@ -1,5 +1,5 @@
126 @@ -1,5 +1,5 @@
127 a
127 a
128 -b
128 -b
129 +b b
129 +b b
130 c
130 c
131 d
131 d
132 e
132 e
133 diff -r 1057167b20ef dir/a.txt
133 diff -r 1057167b20ef dir/a.txt
134 --- a/dir/a.txt
134 --- a/dir/a.txt
135 +++ b/dir/a.txt
135 +++ b/dir/a.txt
136 @@ -1,4 +1,4 @@
136 @@ -1,4 +1,4 @@
137 -hello world
137 -hello world
138 +hello world!
138 +hello world!
139
139
140 someone
140 someone
141 up
141 up
142
142
143 qrecord a.patch
143 qrecord a.patch
144
144
145 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
145 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
146 > y
146 > y
147 > y
147 > y
148 > n
148 > n
149 > y
149 > y
150 > y
150 > y
151 > n
151 > n
152 > EOF
152 > EOF
153 diff --git a/1.txt b/1.txt
153 diff --git a/1.txt b/1.txt
154 2 hunks, 2 lines changed
154 2 hunks, 2 lines changed
155 examine changes to '1.txt'? [Ynsfdaq?]
155 examine changes to '1.txt'? [Ynsfdaq?]
156 @@ -1,3 +1,3 @@
156 @@ -1,3 +1,3 @@
157 1
157 1
158 -2
158 -2
159 +2 2
159 +2 2
160 3
160 3
161 record change 1/6 to '1.txt'? [Ynsfdaq?]
161 record change 1/4 to '1.txt'? [Ynsfdaq?]
162 @@ -3,3 +3,3 @@
162 @@ -3,3 +3,3 @@
163 3
163 3
164 -4
164 -4
165 +4 4
165 +4 4
166 5
166 5
167 record change 2/6 to '1.txt'? [Ynsfdaq?]
167 record change 2/4 to '1.txt'? [Ynsfdaq?]
168 diff --git a/2.txt b/2.txt
168 diff --git a/2.txt b/2.txt
169 1 hunks, 1 lines changed
169 1 hunks, 1 lines changed
170 examine changes to '2.txt'? [Ynsfdaq?]
170 examine changes to '2.txt'? [Ynsfdaq?]
171 @@ -1,5 +1,5 @@
171 @@ -1,5 +1,5 @@
172 a
172 a
173 -b
173 -b
174 +b b
174 +b b
175 c
175 c
176 d
176 d
177 e
177 e
178 record change 4/6 to '2.txt'? [Ynsfdaq?]
178 record change 3/4 to '2.txt'? [Ynsfdaq?]
179 diff --git a/dir/a.txt b/dir/a.txt
179 diff --git a/dir/a.txt b/dir/a.txt
180 1 hunks, 1 lines changed
180 1 hunks, 1 lines changed
181 examine changes to 'dir/a.txt'? [Ynsfdaq?]
181 examine changes to 'dir/a.txt'? [Ynsfdaq?]
182
182
183 After qrecord a.patch 'tip'"
183 After qrecord a.patch 'tip'"
184
184
185 $ hg tip -p
185 $ hg tip -p
186 changeset: 1:5d1ca63427ee
186 changeset: 1:5d1ca63427ee
187 tag: a.patch
187 tag: a.patch
188 tag: qbase
188 tag: qbase
189 tag: qtip
189 tag: qtip
190 tag: tip
190 tag: tip
191 user: test
191 user: test
192 date: Thu Jan 01 00:00:00 1970 +0000
192 date: Thu Jan 01 00:00:00 1970 +0000
193 summary: aaa
193 summary: aaa
194
194
195 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
195 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
196 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
196 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
197 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
197 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
198 @@ -1,5 +1,5 @@
198 @@ -1,5 +1,5 @@
199 1
199 1
200 -2
200 -2
201 +2 2
201 +2 2
202 3
202 3
203 4
203 4
204 5
204 5
205 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
205 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
206 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
206 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
207 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
207 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
208 @@ -1,5 +1,5 @@
208 @@ -1,5 +1,5 @@
209 a
209 a
210 -b
210 -b
211 +b b
211 +b b
212 c
212 c
213 d
213 d
214 e
214 e
215
215
216
216
217 After qrecord a.patch 'diff'"
217 After qrecord a.patch 'diff'"
218
218
219 $ hg diff --nodates
219 $ hg diff --nodates
220 diff -r 5d1ca63427ee 1.txt
220 diff -r 5d1ca63427ee 1.txt
221 --- a/1.txt
221 --- a/1.txt
222 +++ b/1.txt
222 +++ b/1.txt
223 @@ -1,5 +1,5 @@
223 @@ -1,5 +1,5 @@
224 1
224 1
225 2 2
225 2 2
226 3
226 3
227 -4
227 -4
228 +4 4
228 +4 4
229 5
229 5
230 diff -r 5d1ca63427ee dir/a.txt
230 diff -r 5d1ca63427ee dir/a.txt
231 --- a/dir/a.txt
231 --- a/dir/a.txt
232 +++ b/dir/a.txt
232 +++ b/dir/a.txt
233 @@ -1,4 +1,4 @@
233 @@ -1,4 +1,4 @@
234 -hello world
234 -hello world
235 +hello world!
235 +hello world!
236
236
237 someone
237 someone
238 up
238 up
239
239
240 qrecord b.patch
240 qrecord b.patch
241
241
242 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
242 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
243 > y
243 > y
244 > y
244 > y
245 > y
245 > y
246 > y
246 > y
247 > EOF
247 > EOF
248 diff --git a/1.txt b/1.txt
248 diff --git a/1.txt b/1.txt
249 1 hunks, 1 lines changed
249 1 hunks, 1 lines changed
250 examine changes to '1.txt'? [Ynsfdaq?]
250 examine changes to '1.txt'? [Ynsfdaq?]
251 @@ -1,5 +1,5 @@
251 @@ -1,5 +1,5 @@
252 1
252 1
253 2 2
253 2 2
254 3
254 3
255 -4
255 -4
256 +4 4
256 +4 4
257 5
257 5
258 record change 1/3 to '1.txt'? [Ynsfdaq?]
258 record change 1/2 to '1.txt'? [Ynsfdaq?]
259 diff --git a/dir/a.txt b/dir/a.txt
259 diff --git a/dir/a.txt b/dir/a.txt
260 1 hunks, 1 lines changed
260 1 hunks, 1 lines changed
261 examine changes to 'dir/a.txt'? [Ynsfdaq?]
261 examine changes to 'dir/a.txt'? [Ynsfdaq?]
262 @@ -1,4 +1,4 @@
262 @@ -1,4 +1,4 @@
263 -hello world
263 -hello world
264 +hello world!
264 +hello world!
265
265
266 someone
266 someone
267 up
267 up
268 record change 3/3 to 'dir/a.txt'? [Ynsfdaq?]
268 record change 2/2 to 'dir/a.txt'? [Ynsfdaq?]
269
269
270 After qrecord b.patch 'tip'
270 After qrecord b.patch 'tip'
271
271
272 $ hg tip -p
272 $ hg tip -p
273 changeset: 2:b056198bf878
273 changeset: 2:b056198bf878
274 tag: b.patch
274 tag: b.patch
275 tag: qtip
275 tag: qtip
276 tag: tip
276 tag: tip
277 user: test
277 user: test
278 date: Thu Jan 01 00:00:00 1970 +0000
278 date: Thu Jan 01 00:00:00 1970 +0000
279 summary: bbb
279 summary: bbb
280
280
281 diff -r 5d1ca63427ee -r b056198bf878 1.txt
281 diff -r 5d1ca63427ee -r b056198bf878 1.txt
282 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
282 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
283 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
283 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
284 @@ -1,5 +1,5 @@
284 @@ -1,5 +1,5 @@
285 1
285 1
286 2 2
286 2 2
287 3
287 3
288 -4
288 -4
289 +4 4
289 +4 4
290 5
290 5
291 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
291 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
292 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
292 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
293 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
293 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
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
300
301
301
302 After qrecord b.patch 'diff'
302 After qrecord b.patch 'diff'
303
303
304 $ hg diff --nodates
304 $ hg diff --nodates
@@ -1,961 +1,961
1 Set up a repo
1 Set up a repo
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "record=" >> $HGRCPATH
6 $ echo "record=" >> $HGRCPATH
7
7
8 $ hg init a
8 $ hg init a
9 $ cd a
9 $ cd a
10
10
11 Select no files
11 Select no files
12
12
13 $ touch empty-rw
13 $ touch empty-rw
14 $ hg add empty-rw
14 $ hg add empty-rw
15
15
16 $ hg record empty-rw<<EOF
16 $ hg record empty-rw<<EOF
17 > n
17 > n
18 > EOF
18 > EOF
19 diff --git a/empty-rw b/empty-rw
19 diff --git a/empty-rw b/empty-rw
20 new file mode 100644
20 new file mode 100644
21 examine changes to 'empty-rw'? [Ynsfdaq?]
21 examine changes to 'empty-rw'? [Ynsfdaq?]
22 no changes to record
22 no changes to record
23
23
24 $ hg tip -p
24 $ hg tip -p
25 changeset: -1:000000000000
25 changeset: -1:000000000000
26 tag: tip
26 tag: tip
27 user:
27 user:
28 date: Thu Jan 01 00:00:00 1970 +0000
28 date: Thu Jan 01 00:00:00 1970 +0000
29
29
30
30
31
31
32 Select files but no hunks
32 Select files but no hunks
33
33
34 $ hg record empty-rw<<EOF
34 $ hg record empty-rw<<EOF
35 > y
35 > y
36 > n
36 > n
37 > EOF
37 > EOF
38 diff --git a/empty-rw b/empty-rw
38 diff --git a/empty-rw b/empty-rw
39 new file mode 100644
39 new file mode 100644
40 examine changes to 'empty-rw'? [Ynsfdaq?]
40 examine changes to 'empty-rw'? [Ynsfdaq?]
41 abort: empty commit message
41 abort: empty commit message
42 [255]
42 [255]
43
43
44 $ hg tip -p
44 $ hg tip -p
45 changeset: -1:000000000000
45 changeset: -1:000000000000
46 tag: tip
46 tag: tip
47 user:
47 user:
48 date: Thu Jan 01 00:00:00 1970 +0000
48 date: Thu Jan 01 00:00:00 1970 +0000
49
49
50
50
51
51
52 Record empty file
52 Record empty file
53
53
54 $ hg record -d '0 0' -m empty empty-rw<<EOF
54 $ hg record -d '0 0' -m empty empty-rw<<EOF
55 > y
55 > y
56 > y
56 > y
57 > EOF
57 > EOF
58 diff --git a/empty-rw b/empty-rw
58 diff --git a/empty-rw b/empty-rw
59 new file mode 100644
59 new file mode 100644
60 examine changes to 'empty-rw'? [Ynsfdaq?]
60 examine changes to 'empty-rw'? [Ynsfdaq?]
61
61
62 $ hg tip -p
62 $ hg tip -p
63 changeset: 0:c0708cf4e46e
63 changeset: 0:c0708cf4e46e
64 tag: tip
64 tag: tip
65 user: test
65 user: test
66 date: Thu Jan 01 00:00:00 1970 +0000
66 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: empty
67 summary: empty
68
68
69
69
70
70
71 Summary shows we updated to the new cset
71 Summary shows we updated to the new cset
72
72
73 $ hg summary
73 $ hg summary
74 parent: 0:c0708cf4e46e tip
74 parent: 0:c0708cf4e46e tip
75 empty
75 empty
76 branch: default
76 branch: default
77 commit: (clean)
77 commit: (clean)
78 update: (current)
78 update: (current)
79
79
80 Rename empty file
80 Rename empty file
81
81
82 $ hg mv empty-rw empty-rename
82 $ hg mv empty-rw empty-rename
83 $ hg record -d '1 0' -m rename<<EOF
83 $ hg record -d '1 0' -m rename<<EOF
84 > y
84 > y
85 > EOF
85 > EOF
86 diff --git a/empty-rw b/empty-rename
86 diff --git a/empty-rw b/empty-rename
87 rename from empty-rw
87 rename from empty-rw
88 rename to empty-rename
88 rename to empty-rename
89 examine changes to 'empty-rw' and 'empty-rename'? [Ynsfdaq?]
89 examine changes to 'empty-rw' and 'empty-rename'? [Ynsfdaq?]
90
90
91 $ hg tip -p
91 $ hg tip -p
92 changeset: 1:d695e8dcb197
92 changeset: 1:d695e8dcb197
93 tag: tip
93 tag: tip
94 user: test
94 user: test
95 date: Thu Jan 01 00:00:01 1970 +0000
95 date: Thu Jan 01 00:00:01 1970 +0000
96 summary: rename
96 summary: rename
97
97
98
98
99
99
100 Copy empty file
100 Copy empty file
101
101
102 $ hg cp empty-rename empty-copy
102 $ hg cp empty-rename empty-copy
103 $ hg record -d '2 0' -m copy<<EOF
103 $ hg record -d '2 0' -m copy<<EOF
104 > y
104 > y
105 > EOF
105 > EOF
106 diff --git a/empty-rename b/empty-copy
106 diff --git a/empty-rename b/empty-copy
107 copy from empty-rename
107 copy from empty-rename
108 copy to empty-copy
108 copy to empty-copy
109 examine changes to 'empty-rename' and 'empty-copy'? [Ynsfdaq?]
109 examine changes to 'empty-rename' and 'empty-copy'? [Ynsfdaq?]
110
110
111 $ hg tip -p
111 $ hg tip -p
112 changeset: 2:1d4b90bea524
112 changeset: 2:1d4b90bea524
113 tag: tip
113 tag: tip
114 user: test
114 user: test
115 date: Thu Jan 01 00:00:02 1970 +0000
115 date: Thu Jan 01 00:00:02 1970 +0000
116 summary: copy
116 summary: copy
117
117
118
118
119
119
120 Delete empty file
120 Delete empty file
121
121
122 $ hg rm empty-copy
122 $ hg rm empty-copy
123 $ hg record -d '3 0' -m delete<<EOF
123 $ hg record -d '3 0' -m delete<<EOF
124 > y
124 > y
125 > EOF
125 > EOF
126 diff --git a/empty-copy b/empty-copy
126 diff --git a/empty-copy b/empty-copy
127 deleted file mode 100644
127 deleted file mode 100644
128 examine changes to 'empty-copy'? [Ynsfdaq?]
128 examine changes to 'empty-copy'? [Ynsfdaq?]
129
129
130 $ hg tip -p
130 $ hg tip -p
131 changeset: 3:b39a238f01a1
131 changeset: 3:b39a238f01a1
132 tag: tip
132 tag: tip
133 user: test
133 user: test
134 date: Thu Jan 01 00:00:03 1970 +0000
134 date: Thu Jan 01 00:00:03 1970 +0000
135 summary: delete
135 summary: delete
136
136
137
137
138
138
139 Add binary file
139 Add binary file
140
140
141 $ hg bundle --base -2 tip.bundle
141 $ hg bundle --base -2 tip.bundle
142 1 changesets found
142 1 changesets found
143 $ hg add tip.bundle
143 $ hg add tip.bundle
144 $ hg record -d '4 0' -m binary<<EOF
144 $ hg record -d '4 0' -m binary<<EOF
145 > y
145 > y
146 > EOF
146 > EOF
147 diff --git a/tip.bundle b/tip.bundle
147 diff --git a/tip.bundle b/tip.bundle
148 new file mode 100644
148 new file mode 100644
149 this is a binary file
149 this is a binary file
150 examine changes to 'tip.bundle'? [Ynsfdaq?]
150 examine changes to 'tip.bundle'? [Ynsfdaq?]
151
151
152 $ hg tip -p
152 $ hg tip -p
153 changeset: 4:ad816da3711e
153 changeset: 4:ad816da3711e
154 tag: tip
154 tag: tip
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:04 1970 +0000
156 date: Thu Jan 01 00:00:04 1970 +0000
157 summary: binary
157 summary: binary
158
158
159 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
159 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
160 Binary file tip.bundle has changed
160 Binary file tip.bundle has changed
161
161
162
162
163 Change binary file
163 Change binary file
164
164
165 $ hg bundle --base -2 tip.bundle
165 $ hg bundle --base -2 tip.bundle
166 1 changesets found
166 1 changesets found
167 $ hg record -d '5 0' -m binary-change<<EOF
167 $ hg record -d '5 0' -m binary-change<<EOF
168 > y
168 > y
169 > EOF
169 > EOF
170 diff --git a/tip.bundle b/tip.bundle
170 diff --git a/tip.bundle b/tip.bundle
171 this modifies a binary file (all or nothing)
171 this modifies a binary file (all or nothing)
172 examine changes to 'tip.bundle'? [Ynsfdaq?]
172 examine changes to 'tip.bundle'? [Ynsfdaq?]
173
173
174 $ hg tip -p
174 $ hg tip -p
175 changeset: 5:dccd6f3eb485
175 changeset: 5:dccd6f3eb485
176 tag: tip
176 tag: tip
177 user: test
177 user: test
178 date: Thu Jan 01 00:00:05 1970 +0000
178 date: Thu Jan 01 00:00:05 1970 +0000
179 summary: binary-change
179 summary: binary-change
180
180
181 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
181 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
182 Binary file tip.bundle has changed
182 Binary file tip.bundle has changed
183
183
184
184
185 Rename and change binary file
185 Rename and change binary file
186
186
187 $ hg mv tip.bundle top.bundle
187 $ hg mv tip.bundle top.bundle
188 $ hg bundle --base -2 top.bundle
188 $ hg bundle --base -2 top.bundle
189 1 changesets found
189 1 changesets found
190 $ hg record -d '6 0' -m binary-change-rename<<EOF
190 $ hg record -d '6 0' -m binary-change-rename<<EOF
191 > y
191 > y
192 > EOF
192 > EOF
193 diff --git a/tip.bundle b/top.bundle
193 diff --git a/tip.bundle b/top.bundle
194 rename from tip.bundle
194 rename from tip.bundle
195 rename to top.bundle
195 rename to top.bundle
196 this modifies a binary file (all or nothing)
196 this modifies a binary file (all or nothing)
197 examine changes to 'tip.bundle' and 'top.bundle'? [Ynsfdaq?]
197 examine changes to 'tip.bundle' and 'top.bundle'? [Ynsfdaq?]
198
198
199 $ hg tip -p
199 $ hg tip -p
200 changeset: 6:7fa44105f5b3
200 changeset: 6:7fa44105f5b3
201 tag: tip
201 tag: tip
202 user: test
202 user: test
203 date: Thu Jan 01 00:00:06 1970 +0000
203 date: Thu Jan 01 00:00:06 1970 +0000
204 summary: binary-change-rename
204 summary: binary-change-rename
205
205
206 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
206 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
207 Binary file tip.bundle has changed
207 Binary file tip.bundle has changed
208 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
208 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
209 Binary file top.bundle has changed
209 Binary file top.bundle has changed
210
210
211
211
212 Add plain file
212 Add plain file
213
213
214 $ for i in 1 2 3 4 5 6 7 8 9 10; do
214 $ for i in 1 2 3 4 5 6 7 8 9 10; do
215 > echo $i >> plain
215 > echo $i >> plain
216 > done
216 > done
217
217
218 $ hg add plain
218 $ hg add plain
219 $ hg record -d '7 0' -m plain plain<<EOF
219 $ hg record -d '7 0' -m plain plain<<EOF
220 > y
220 > y
221 > y
221 > y
222 > EOF
222 > EOF
223 diff --git a/plain b/plain
223 diff --git a/plain b/plain
224 new file mode 100644
224 new file mode 100644
225 examine changes to 'plain'? [Ynsfdaq?]
225 examine changes to 'plain'? [Ynsfdaq?]
226
226
227 $ hg tip -p
227 $ hg tip -p
228 changeset: 7:11fb457c1be4
228 changeset: 7:11fb457c1be4
229 tag: tip
229 tag: tip
230 user: test
230 user: test
231 date: Thu Jan 01 00:00:07 1970 +0000
231 date: Thu Jan 01 00:00:07 1970 +0000
232 summary: plain
232 summary: plain
233
233
234 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
234 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
235 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
235 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
236 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
236 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
237 @@ -0,0 +1,10 @@
237 @@ -0,0 +1,10 @@
238 +1
238 +1
239 +2
239 +2
240 +3
240 +3
241 +4
241 +4
242 +5
242 +5
243 +6
243 +6
244 +7
244 +7
245 +8
245 +8
246 +9
246 +9
247 +10
247 +10
248
248
249
249
250 Modify end of plain file
250 Modify end of plain file
251
251
252 $ echo 11 >> plain
252 $ echo 11 >> plain
253 $ hg record -d '8 0' -m end plain <<EOF
253 $ hg record -d '8 0' -m end plain <<EOF
254 > y
254 > y
255 > y
255 > y
256 > EOF
256 > EOF
257 diff --git a/plain b/plain
257 diff --git a/plain b/plain
258 1 hunks, 1 lines changed
258 1 hunks, 1 lines changed
259 examine changes to 'plain'? [Ynsfdaq?]
259 examine changes to 'plain'? [Ynsfdaq?]
260 @@ -8,3 +8,4 @@
260 @@ -8,3 +8,4 @@
261 8
261 8
262 9
262 9
263 10
263 10
264 +11
264 +11
265 record this change to 'plain'? [Ynsfdaq?]
265 record this change to 'plain'? [Ynsfdaq?]
266
266
267 Modify end of plain file, no EOL
267 Modify end of plain file, no EOL
268
268
269 $ hg tip --template '{node}' >> plain
269 $ hg tip --template '{node}' >> plain
270 $ hg record -d '9 0' -m noeol plain <<EOF
270 $ hg record -d '9 0' -m noeol plain <<EOF
271 > y
271 > y
272 > y
272 > y
273 > EOF
273 > EOF
274 diff --git a/plain b/plain
274 diff --git a/plain b/plain
275 1 hunks, 1 lines changed
275 1 hunks, 1 lines changed
276 examine changes to 'plain'? [Ynsfdaq?]
276 examine changes to 'plain'? [Ynsfdaq?]
277 @@ -9,3 +9,4 @@
277 @@ -9,3 +9,4 @@
278 9
278 9
279 10
279 10
280 11
280 11
281 +7264f99c5f5ff3261504828afa4fb4d406c3af54
281 +7264f99c5f5ff3261504828afa4fb4d406c3af54
282 \ No newline at end of file
282 \ No newline at end of file
283 record this change to 'plain'? [Ynsfdaq?]
283 record this change to 'plain'? [Ynsfdaq?]
284
284
285 Modify end of plain file, add EOL
285 Modify end of plain file, add EOL
286
286
287 $ echo >> plain
287 $ echo >> plain
288 $ echo 1 > plain2
288 $ echo 1 > plain2
289 $ hg add plain2
289 $ hg add plain2
290 $ hg record -d '10 0' -m eol plain plain2 <<EOF
290 $ hg record -d '10 0' -m eol plain plain2 <<EOF
291 > y
291 > y
292 > y
292 > y
293 > y
293 > y
294 > EOF
294 > EOF
295 diff --git a/plain b/plain
295 diff --git a/plain b/plain
296 1 hunks, 1 lines changed
296 1 hunks, 1 lines changed
297 examine changes to 'plain'? [Ynsfdaq?]
297 examine changes to 'plain'? [Ynsfdaq?]
298 @@ -9,4 +9,4 @@
298 @@ -9,4 +9,4 @@
299 9
299 9
300 10
300 10
301 11
301 11
302 -7264f99c5f5ff3261504828afa4fb4d406c3af54
302 -7264f99c5f5ff3261504828afa4fb4d406c3af54
303 \ No newline at end of file
303 \ No newline at end of file
304 +7264f99c5f5ff3261504828afa4fb4d406c3af54
304 +7264f99c5f5ff3261504828afa4fb4d406c3af54
305 record change 1/3 to 'plain'? [Ynsfdaq?]
305 record change 1/2 to 'plain'? [Ynsfdaq?]
306 diff --git a/plain2 b/plain2
306 diff --git a/plain2 b/plain2
307 new file mode 100644
307 new file mode 100644
308 examine changes to 'plain2'? [Ynsfdaq?]
308 examine changes to 'plain2'? [Ynsfdaq?]
309
309
310 Modify beginning, trim end, record both, add another file to test
310 Modify beginning, trim end, record both, add another file to test
311 changes numbering
311 changes numbering
312
312
313 $ rm plain
313 $ rm plain
314 $ for i in 2 2 3 4 5 6 7 8 9 10; do
314 $ for i in 2 2 3 4 5 6 7 8 9 10; do
315 > echo $i >> plain
315 > echo $i >> plain
316 > done
316 > done
317 $ echo 2 >> plain2
317 $ echo 2 >> plain2
318
318
319 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
319 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
320 > y
320 > y
321 > y
321 > y
322 > y
322 > y
323 > y
323 > y
324 > y
324 > y
325 > EOF
325 > EOF
326 diff --git a/plain b/plain
326 diff --git a/plain b/plain
327 2 hunks, 3 lines changed
327 2 hunks, 3 lines changed
328 examine changes to 'plain'? [Ynsfdaq?]
328 examine changes to 'plain'? [Ynsfdaq?]
329 @@ -1,4 +1,4 @@
329 @@ -1,4 +1,4 @@
330 -1
330 -1
331 +2
331 +2
332 2
332 2
333 3
333 3
334 4
334 4
335 record change 1/4 to 'plain'? [Ynsfdaq?]
335 record change 1/3 to 'plain'? [Ynsfdaq?]
336 @@ -8,5 +8,3 @@
336 @@ -8,5 +8,3 @@
337 8
337 8
338 9
338 9
339 10
339 10
340 -11
340 -11
341 -7264f99c5f5ff3261504828afa4fb4d406c3af54
341 -7264f99c5f5ff3261504828afa4fb4d406c3af54
342 record change 2/4 to 'plain'? [Ynsfdaq?]
342 record change 2/3 to 'plain'? [Ynsfdaq?]
343 diff --git a/plain2 b/plain2
343 diff --git a/plain2 b/plain2
344 1 hunks, 1 lines changed
344 1 hunks, 1 lines changed
345 examine changes to 'plain2'? [Ynsfdaq?]
345 examine changes to 'plain2'? [Ynsfdaq?]
346 @@ -1,1 +1,2 @@
346 @@ -1,1 +1,2 @@
347 1
347 1
348 +2
348 +2
349 record change 4/4 to 'plain2'? [Ynsfdaq?]
349 record change 3/3 to 'plain2'? [Ynsfdaq?]
350
350
351 $ hg tip -p
351 $ hg tip -p
352 changeset: 11:21df83db12b8
352 changeset: 11:21df83db12b8
353 tag: tip
353 tag: tip
354 user: test
354 user: test
355 date: Thu Jan 01 00:00:10 1970 +0000
355 date: Thu Jan 01 00:00:10 1970 +0000
356 summary: begin-and-end
356 summary: begin-and-end
357
357
358 diff -r ddb8b281c3ff -r 21df83db12b8 plain
358 diff -r ddb8b281c3ff -r 21df83db12b8 plain
359 --- a/plain Thu Jan 01 00:00:10 1970 +0000
359 --- a/plain Thu Jan 01 00:00:10 1970 +0000
360 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
360 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
361 @@ -1,4 +1,4 @@
361 @@ -1,4 +1,4 @@
362 -1
362 -1
363 +2
363 +2
364 2
364 2
365 3
365 3
366 4
366 4
367 @@ -8,5 +8,3 @@
367 @@ -8,5 +8,3 @@
368 8
368 8
369 9
369 9
370 10
370 10
371 -11
371 -11
372 -7264f99c5f5ff3261504828afa4fb4d406c3af54
372 -7264f99c5f5ff3261504828afa4fb4d406c3af54
373 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
373 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
374 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
374 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
375 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
375 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
376 @@ -1,1 +1,2 @@
376 @@ -1,1 +1,2 @@
377 1
377 1
378 +2
378 +2
379
379
380
380
381 Trim beginning, modify end
381 Trim beginning, modify end
382
382
383 $ rm plain
383 $ rm plain
384 > for i in 4 5 6 7 8 9 10.new; do
384 > for i in 4 5 6 7 8 9 10.new; do
385 > echo $i >> plain
385 > echo $i >> plain
386 > done
386 > done
387
387
388 Record end
388 Record end
389
389
390 $ hg record -d '11 0' -m end-only plain <<EOF
390 $ hg record -d '11 0' -m end-only plain <<EOF
391 > y
391 > y
392 > n
392 > n
393 > y
393 > y
394 > EOF
394 > EOF
395 diff --git a/plain b/plain
395 diff --git a/plain b/plain
396 2 hunks, 4 lines changed
396 2 hunks, 4 lines changed
397 examine changes to 'plain'? [Ynsfdaq?]
397 examine changes to 'plain'? [Ynsfdaq?]
398 @@ -1,9 +1,6 @@
398 @@ -1,9 +1,6 @@
399 -2
399 -2
400 -2
400 -2
401 -3
401 -3
402 4
402 4
403 5
403 5
404 6
404 6
405 7
405 7
406 8
406 8
407 9
407 9
408 record change 1/2 to 'plain'? [Ynsfdaq?]
408 record change 1/2 to 'plain'? [Ynsfdaq?]
409 @@ -4,7 +1,7 @@
409 @@ -4,7 +1,7 @@
410 4
410 4
411 5
411 5
412 6
412 6
413 7
413 7
414 8
414 8
415 9
415 9
416 -10
416 -10
417 +10.new
417 +10.new
418 record change 2/2 to 'plain'? [Ynsfdaq?]
418 record change 2/2 to 'plain'? [Ynsfdaq?]
419
419
420 $ hg tip -p
420 $ hg tip -p
421 changeset: 12:99337501826f
421 changeset: 12:99337501826f
422 tag: tip
422 tag: tip
423 user: test
423 user: test
424 date: Thu Jan 01 00:00:11 1970 +0000
424 date: Thu Jan 01 00:00:11 1970 +0000
425 summary: end-only
425 summary: end-only
426
426
427 diff -r 21df83db12b8 -r 99337501826f plain
427 diff -r 21df83db12b8 -r 99337501826f plain
428 --- a/plain Thu Jan 01 00:00:10 1970 +0000
428 --- a/plain Thu Jan 01 00:00:10 1970 +0000
429 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
429 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
430 @@ -7,4 +7,4 @@
430 @@ -7,4 +7,4 @@
431 7
431 7
432 8
432 8
433 9
433 9
434 -10
434 -10
435 +10.new
435 +10.new
436
436
437
437
438 Record beginning
438 Record beginning
439
439
440 $ hg record -d '12 0' -m begin-only plain <<EOF
440 $ hg record -d '12 0' -m begin-only plain <<EOF
441 > y
441 > y
442 > y
442 > y
443 > EOF
443 > EOF
444 diff --git a/plain b/plain
444 diff --git a/plain b/plain
445 1 hunks, 3 lines changed
445 1 hunks, 3 lines changed
446 examine changes to 'plain'? [Ynsfdaq?]
446 examine changes to 'plain'? [Ynsfdaq?]
447 @@ -1,6 +1,3 @@
447 @@ -1,6 +1,3 @@
448 -2
448 -2
449 -2
449 -2
450 -3
450 -3
451 4
451 4
452 5
452 5
453 6
453 6
454 record this change to 'plain'? [Ynsfdaq?]
454 record this change to 'plain'? [Ynsfdaq?]
455
455
456 $ hg tip -p
456 $ hg tip -p
457 changeset: 13:bbd45465d540
457 changeset: 13:bbd45465d540
458 tag: tip
458 tag: tip
459 user: test
459 user: test
460 date: Thu Jan 01 00:00:12 1970 +0000
460 date: Thu Jan 01 00:00:12 1970 +0000
461 summary: begin-only
461 summary: begin-only
462
462
463 diff -r 99337501826f -r bbd45465d540 plain
463 diff -r 99337501826f -r bbd45465d540 plain
464 --- a/plain Thu Jan 01 00:00:11 1970 +0000
464 --- a/plain Thu Jan 01 00:00:11 1970 +0000
465 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
465 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
466 @@ -1,6 +1,3 @@
466 @@ -1,6 +1,3 @@
467 -2
467 -2
468 -2
468 -2
469 -3
469 -3
470 4
470 4
471 5
471 5
472 6
472 6
473
473
474
474
475 Add to beginning, trim from end
475 Add to beginning, trim from end
476
476
477 $ rm plain
477 $ rm plain
478 $ for i in 1 2 3 4 5 6 7 8 9; do
478 $ for i in 1 2 3 4 5 6 7 8 9; do
479 > echo $i >> plain
479 > echo $i >> plain
480 > done
480 > done
481
481
482 Record end
482 Record end
483
483
484 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
484 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
485 > y
485 > y
486 > n
486 > n
487 > y
487 > y
488 > EOF
488 > EOF
489 diff --git a/plain b/plain
489 diff --git a/plain b/plain
490 2 hunks, 4 lines changed
490 2 hunks, 4 lines changed
491 examine changes to 'plain'? [Ynsfdaq?]
491 examine changes to 'plain'? [Ynsfdaq?]
492 @@ -1,6 +1,9 @@
492 @@ -1,6 +1,9 @@
493 +1
493 +1
494 +2
494 +2
495 +3
495 +3
496 4
496 4
497 5
497 5
498 6
498 6
499 7
499 7
500 8
500 8
501 9
501 9
502 record change 1/2 to 'plain'? [Ynsfdaq?]
502 record change 1/2 to 'plain'? [Ynsfdaq?]
503 @@ -1,7 +4,6 @@
503 @@ -1,7 +4,6 @@
504 4
504 4
505 5
505 5
506 6
506 6
507 7
507 7
508 8
508 8
509 9
509 9
510 -10.new
510 -10.new
511 record change 2/2 to 'plain'? [Ynsfdaq?]
511 record change 2/2 to 'plain'? [Ynsfdaq?]
512
512
513 Add to beginning, middle, end
513 Add to beginning, middle, end
514
514
515 $ rm plain
515 $ rm plain
516 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
516 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
517 > echo $i >> plain
517 > echo $i >> plain
518 > done
518 > done
519
519
520 Record beginning, middle
520 Record beginning, middle
521
521
522 $ hg record -d '14 0' -m middle-only plain <<EOF
522 $ hg record -d '14 0' -m middle-only plain <<EOF
523 > y
523 > y
524 > y
524 > y
525 > y
525 > y
526 > n
526 > n
527 > EOF
527 > EOF
528 diff --git a/plain b/plain
528 diff --git a/plain b/plain
529 3 hunks, 7 lines changed
529 3 hunks, 7 lines changed
530 examine changes to 'plain'? [Ynsfdaq?]
530 examine changes to 'plain'? [Ynsfdaq?]
531 @@ -1,2 +1,5 @@
531 @@ -1,2 +1,5 @@
532 +1
532 +1
533 +2
533 +2
534 +3
534 +3
535 4
535 4
536 5
536 5
537 record change 1/3 to 'plain'? [Ynsfdaq?]
537 record change 1/3 to 'plain'? [Ynsfdaq?]
538 @@ -1,6 +4,8 @@
538 @@ -1,6 +4,8 @@
539 4
539 4
540 5
540 5
541 +5.new
541 +5.new
542 +5.reallynew
542 +5.reallynew
543 6
543 6
544 7
544 7
545 8
545 8
546 9
546 9
547 record change 2/3 to 'plain'? [Ynsfdaq?]
547 record change 2/3 to 'plain'? [Ynsfdaq?]
548 @@ -3,4 +8,6 @@
548 @@ -3,4 +8,6 @@
549 6
549 6
550 7
550 7
551 8
551 8
552 9
552 9
553 +10
553 +10
554 +11
554 +11
555 record change 3/3 to 'plain'? [Ynsfdaq?]
555 record change 3/3 to 'plain'? [Ynsfdaq?]
556
556
557 $ hg tip -p
557 $ hg tip -p
558 changeset: 15:f34a7937ec33
558 changeset: 15:f34a7937ec33
559 tag: tip
559 tag: tip
560 user: test
560 user: test
561 date: Thu Jan 01 00:00:14 1970 +0000
561 date: Thu Jan 01 00:00:14 1970 +0000
562 summary: middle-only
562 summary: middle-only
563
563
564 diff -r 82c065d0b850 -r f34a7937ec33 plain
564 diff -r 82c065d0b850 -r f34a7937ec33 plain
565 --- a/plain Thu Jan 01 00:00:13 1970 +0000
565 --- a/plain Thu Jan 01 00:00:13 1970 +0000
566 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
566 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
567 @@ -1,5 +1,10 @@
567 @@ -1,5 +1,10 @@
568 +1
568 +1
569 +2
569 +2
570 +3
570 +3
571 4
571 4
572 5
572 5
573 +5.new
573 +5.new
574 +5.reallynew
574 +5.reallynew
575 6
575 6
576 7
576 7
577 8
577 8
578
578
579
579
580 Record end
580 Record end
581
581
582 $ hg record -d '15 0' -m end-only plain <<EOF
582 $ hg record -d '15 0' -m end-only plain <<EOF
583 > y
583 > y
584 > y
584 > y
585 > EOF
585 > EOF
586 diff --git a/plain b/plain
586 diff --git a/plain b/plain
587 1 hunks, 2 lines changed
587 1 hunks, 2 lines changed
588 examine changes to 'plain'? [Ynsfdaq?]
588 examine changes to 'plain'? [Ynsfdaq?]
589 @@ -9,3 +9,5 @@
589 @@ -9,3 +9,5 @@
590 7
590 7
591 8
591 8
592 9
592 9
593 +10
593 +10
594 +11
594 +11
595 record this change to 'plain'? [Ynsfdaq?]
595 record this change to 'plain'? [Ynsfdaq?]
596
596
597 $ hg tip -p
597 $ hg tip -p
598 changeset: 16:f9900b71a04c
598 changeset: 16:f9900b71a04c
599 tag: tip
599 tag: tip
600 user: test
600 user: test
601 date: Thu Jan 01 00:00:15 1970 +0000
601 date: Thu Jan 01 00:00:15 1970 +0000
602 summary: end-only
602 summary: end-only
603
603
604 diff -r f34a7937ec33 -r f9900b71a04c plain
604 diff -r f34a7937ec33 -r f9900b71a04c plain
605 --- a/plain Thu Jan 01 00:00:14 1970 +0000
605 --- a/plain Thu Jan 01 00:00:14 1970 +0000
606 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
606 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
607 @@ -9,3 +9,5 @@
607 @@ -9,3 +9,5 @@
608 7
608 7
609 8
609 8
610 9
610 9
611 +10
611 +10
612 +11
612 +11
613
613
614
614
615 $ mkdir subdir
615 $ mkdir subdir
616 $ cd subdir
616 $ cd subdir
617 $ echo a > a
617 $ echo a > a
618 $ hg ci -d '16 0' -Amsubdir
618 $ hg ci -d '16 0' -Amsubdir
619 adding subdir/a
619 adding subdir/a
620
620
621 $ echo a >> a
621 $ echo a >> a
622 $ hg record -d '16 0' -m subdir-change a <<EOF
622 $ hg record -d '16 0' -m subdir-change a <<EOF
623 > y
623 > y
624 > y
624 > y
625 > EOF
625 > EOF
626 diff --git a/subdir/a b/subdir/a
626 diff --git a/subdir/a b/subdir/a
627 1 hunks, 1 lines changed
627 1 hunks, 1 lines changed
628 examine changes to 'subdir/a'? [Ynsfdaq?]
628 examine changes to 'subdir/a'? [Ynsfdaq?]
629 @@ -1,1 +1,2 @@
629 @@ -1,1 +1,2 @@
630 a
630 a
631 +a
631 +a
632 record this change to 'subdir/a'? [Ynsfdaq?]
632 record this change to 'subdir/a'? [Ynsfdaq?]
633
633
634 $ hg tip -p
634 $ hg tip -p
635 changeset: 18:61be427a9deb
635 changeset: 18:61be427a9deb
636 tag: tip
636 tag: tip
637 user: test
637 user: test
638 date: Thu Jan 01 00:00:16 1970 +0000
638 date: Thu Jan 01 00:00:16 1970 +0000
639 summary: subdir-change
639 summary: subdir-change
640
640
641 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
641 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
642 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
642 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
643 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
643 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
644 @@ -1,1 +1,2 @@
644 @@ -1,1 +1,2 @@
645 a
645 a
646 +a
646 +a
647
647
648
648
649 $ echo a > f1
649 $ echo a > f1
650 $ echo b > f2
650 $ echo b > f2
651 $ hg add f1 f2
651 $ hg add f1 f2
652
652
653 $ hg ci -mz -d '17 0'
653 $ hg ci -mz -d '17 0'
654
654
655 $ echo a >> f1
655 $ echo a >> f1
656 $ echo b >> f2
656 $ echo b >> f2
657
657
658 Help, quit
658 Help, quit
659
659
660 $ hg record <<EOF
660 $ hg record <<EOF
661 > ?
661 > ?
662 > q
662 > q
663 > EOF
663 > EOF
664 diff --git a/subdir/f1 b/subdir/f1
664 diff --git a/subdir/f1 b/subdir/f1
665 1 hunks, 1 lines changed
665 1 hunks, 1 lines changed
666 examine changes to 'subdir/f1'? [Ynsfdaq?]
666 examine changes to 'subdir/f1'? [Ynsfdaq?]
667 y - record this change
667 y - record this change
668 n - skip this change
668 n - skip this change
669 s - skip remaining changes to this file
669 s - skip remaining changes to this file
670 f - record remaining changes to this file
670 f - record remaining changes to this file
671 d - done, skip remaining changes and files
671 d - done, skip remaining changes and files
672 a - record all changes to all remaining files
672 a - record all changes to all remaining files
673 q - quit, recording no changes
673 q - quit, recording no changes
674 ? - display help
674 ? - display help
675 examine changes to 'subdir/f1'? [Ynsfdaq?]
675 examine changes to 'subdir/f1'? [Ynsfdaq?]
676 abort: user quit
676 abort: user quit
677 [255]
677 [255]
678
678
679 Skip
679 Skip
680
680
681 $ hg record <<EOF
681 $ hg record <<EOF
682 > s
682 > s
683 > EOF
683 > EOF
684 diff --git a/subdir/f1 b/subdir/f1
684 diff --git a/subdir/f1 b/subdir/f1
685 1 hunks, 1 lines changed
685 1 hunks, 1 lines changed
686 examine changes to 'subdir/f1'? [Ynsfdaq?]
686 examine changes to 'subdir/f1'? [Ynsfdaq?]
687 diff --git a/subdir/f2 b/subdir/f2
687 diff --git a/subdir/f2 b/subdir/f2
688 1 hunks, 1 lines changed
688 1 hunks, 1 lines changed
689 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
689 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
690 [255]
690 [255]
691
691
692 No
692 No
693
693
694 $ hg record <<EOF
694 $ hg record <<EOF
695 > n
695 > n
696 > EOF
696 > EOF
697 diff --git a/subdir/f1 b/subdir/f1
697 diff --git a/subdir/f1 b/subdir/f1
698 1 hunks, 1 lines changed
698 1 hunks, 1 lines changed
699 examine changes to 'subdir/f1'? [Ynsfdaq?]
699 examine changes to 'subdir/f1'? [Ynsfdaq?]
700 diff --git a/subdir/f2 b/subdir/f2
700 diff --git a/subdir/f2 b/subdir/f2
701 1 hunks, 1 lines changed
701 1 hunks, 1 lines changed
702 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
702 examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected
703 [255]
703 [255]
704
704
705 f, quit
705 f, quit
706
706
707 $ hg record <<EOF
707 $ hg record <<EOF
708 > f
708 > f
709 > q
709 > q
710 > EOF
710 > EOF
711 diff --git a/subdir/f1 b/subdir/f1
711 diff --git a/subdir/f1 b/subdir/f1
712 1 hunks, 1 lines changed
712 1 hunks, 1 lines changed
713 examine changes to 'subdir/f1'? [Ynsfdaq?]
713 examine changes to 'subdir/f1'? [Ynsfdaq?]
714 diff --git a/subdir/f2 b/subdir/f2
714 diff --git a/subdir/f2 b/subdir/f2
715 1 hunks, 1 lines changed
715 1 hunks, 1 lines changed
716 examine changes to 'subdir/f2'? [Ynsfdaq?]
716 examine changes to 'subdir/f2'? [Ynsfdaq?]
717 abort: user quit
717 abort: user quit
718 [255]
718 [255]
719
719
720 s, all
720 s, all
721
721
722 $ hg record -d '18 0' -mx <<EOF
722 $ hg record -d '18 0' -mx <<EOF
723 > s
723 > s
724 > a
724 > a
725 > EOF
725 > EOF
726 diff --git a/subdir/f1 b/subdir/f1
726 diff --git a/subdir/f1 b/subdir/f1
727 1 hunks, 1 lines changed
727 1 hunks, 1 lines changed
728 examine changes to 'subdir/f1'? [Ynsfdaq?]
728 examine changes to 'subdir/f1'? [Ynsfdaq?]
729 diff --git a/subdir/f2 b/subdir/f2
729 diff --git a/subdir/f2 b/subdir/f2
730 1 hunks, 1 lines changed
730 1 hunks, 1 lines changed
731 examine changes to 'subdir/f2'? [Ynsfdaq?]
731 examine changes to 'subdir/f2'? [Ynsfdaq?]
732
732
733 $ hg tip -p
733 $ hg tip -p
734 changeset: 20:b3df3dda369a
734 changeset: 20:b3df3dda369a
735 tag: tip
735 tag: tip
736 user: test
736 user: test
737 date: Thu Jan 01 00:00:18 1970 +0000
737 date: Thu Jan 01 00:00:18 1970 +0000
738 summary: x
738 summary: x
739
739
740 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
740 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
741 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
741 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
742 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
742 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
743 @@ -1,1 +1,2 @@
743 @@ -1,1 +1,2 @@
744 b
744 b
745 +b
745 +b
746
746
747
747
748 f
748 f
749
749
750 $ hg record -d '19 0' -my <<EOF
750 $ hg record -d '19 0' -my <<EOF
751 > f
751 > f
752 > EOF
752 > EOF
753 diff --git a/subdir/f1 b/subdir/f1
753 diff --git a/subdir/f1 b/subdir/f1
754 1 hunks, 1 lines changed
754 1 hunks, 1 lines changed
755 examine changes to 'subdir/f1'? [Ynsfdaq?]
755 examine changes to 'subdir/f1'? [Ynsfdaq?]
756
756
757 $ hg tip -p
757 $ hg tip -p
758 changeset: 21:38ec577f126b
758 changeset: 21:38ec577f126b
759 tag: tip
759 tag: tip
760 user: test
760 user: test
761 date: Thu Jan 01 00:00:19 1970 +0000
761 date: Thu Jan 01 00:00:19 1970 +0000
762 summary: y
762 summary: y
763
763
764 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
764 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
765 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
765 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
766 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
766 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
767 @@ -1,1 +1,2 @@
767 @@ -1,1 +1,2 @@
768 a
768 a
769 +a
769 +a
770
770
771
771
772 Preserve chmod +x
772 Preserve chmod +x
773
773
774 $ chmod +x f1
774 $ chmod +x f1
775 $ echo a >> f1
775 $ echo a >> f1
776 $ hg record -d '20 0' -mz <<EOF
776 $ hg record -d '20 0' -mz <<EOF
777 > y
777 > y
778 > y
778 > y
779 > y
779 > y
780 > EOF
780 > EOF
781 diff --git a/subdir/f1 b/subdir/f1
781 diff --git a/subdir/f1 b/subdir/f1
782 old mode 100644
782 old mode 100644
783 new mode 100755
783 new mode 100755
784 1 hunks, 1 lines changed
784 1 hunks, 1 lines changed
785 examine changes to 'subdir/f1'? [Ynsfdaq?]
785 examine changes to 'subdir/f1'? [Ynsfdaq?]
786 @@ -1,2 +1,3 @@
786 @@ -1,2 +1,3 @@
787 a
787 a
788 a
788 a
789 +a
789 +a
790 record this change to 'subdir/f1'? [Ynsfdaq?]
790 record this change to 'subdir/f1'? [Ynsfdaq?]
791
791
792 $ hg tip --config diff.git=True -p
792 $ hg tip --config diff.git=True -p
793 changeset: 22:3261adceb075
793 changeset: 22:3261adceb075
794 tag: tip
794 tag: tip
795 user: test
795 user: test
796 date: Thu Jan 01 00:00:20 1970 +0000
796 date: Thu Jan 01 00:00:20 1970 +0000
797 summary: z
797 summary: z
798
798
799 diff --git a/subdir/f1 b/subdir/f1
799 diff --git a/subdir/f1 b/subdir/f1
800 old mode 100644
800 old mode 100644
801 new mode 100755
801 new mode 100755
802 --- a/subdir/f1
802 --- a/subdir/f1
803 +++ b/subdir/f1
803 +++ b/subdir/f1
804 @@ -1,2 +1,3 @@
804 @@ -1,2 +1,3 @@
805 a
805 a
806 a
806 a
807 +a
807 +a
808
808
809
809
810 Preserve execute permission on original
810 Preserve execute permission on original
811
811
812 $ echo b >> f1
812 $ echo b >> f1
813 $ hg record -d '21 0' -maa <<EOF
813 $ hg record -d '21 0' -maa <<EOF
814 > y
814 > y
815 > y
815 > y
816 > y
816 > y
817 > EOF
817 > EOF
818 diff --git a/subdir/f1 b/subdir/f1
818 diff --git a/subdir/f1 b/subdir/f1
819 1 hunks, 1 lines changed
819 1 hunks, 1 lines changed
820 examine changes to 'subdir/f1'? [Ynsfdaq?]
820 examine changes to 'subdir/f1'? [Ynsfdaq?]
821 @@ -1,3 +1,4 @@
821 @@ -1,3 +1,4 @@
822 a
822 a
823 a
823 a
824 a
824 a
825 +b
825 +b
826 record this change to 'subdir/f1'? [Ynsfdaq?]
826 record this change to 'subdir/f1'? [Ynsfdaq?]
827
827
828 $ hg tip --config diff.git=True -p
828 $ hg tip --config diff.git=True -p
829 changeset: 23:b429867550db
829 changeset: 23:b429867550db
830 tag: tip
830 tag: tip
831 user: test
831 user: test
832 date: Thu Jan 01 00:00:21 1970 +0000
832 date: Thu Jan 01 00:00:21 1970 +0000
833 summary: aa
833 summary: aa
834
834
835 diff --git a/subdir/f1 b/subdir/f1
835 diff --git a/subdir/f1 b/subdir/f1
836 --- a/subdir/f1
836 --- a/subdir/f1
837 +++ b/subdir/f1
837 +++ b/subdir/f1
838 @@ -1,3 +1,4 @@
838 @@ -1,3 +1,4 @@
839 a
839 a
840 a
840 a
841 a
841 a
842 +b
842 +b
843
843
844
844
845 Preserve chmod -x
845 Preserve chmod -x
846
846
847 $ chmod -x f1
847 $ chmod -x f1
848 $ echo c >> f1
848 $ echo c >> f1
849 $ hg record -d '22 0' -mab <<EOF
849 $ hg record -d '22 0' -mab <<EOF
850 > y
850 > y
851 > y
851 > y
852 > y
852 > y
853 > EOF
853 > EOF
854 diff --git a/subdir/f1 b/subdir/f1
854 diff --git a/subdir/f1 b/subdir/f1
855 old mode 100755
855 old mode 100755
856 new mode 100644
856 new mode 100644
857 1 hunks, 1 lines changed
857 1 hunks, 1 lines changed
858 examine changes to 'subdir/f1'? [Ynsfdaq?]
858 examine changes to 'subdir/f1'? [Ynsfdaq?]
859 @@ -2,3 +2,4 @@
859 @@ -2,3 +2,4 @@
860 a
860 a
861 a
861 a
862 b
862 b
863 +c
863 +c
864 record this change to 'subdir/f1'? [Ynsfdaq?]
864 record this change to 'subdir/f1'? [Ynsfdaq?]
865
865
866 $ hg tip --config diff.git=True -p
866 $ hg tip --config diff.git=True -p
867 changeset: 24:0b082130c20a
867 changeset: 24:0b082130c20a
868 tag: tip
868 tag: tip
869 user: test
869 user: test
870 date: Thu Jan 01 00:00:22 1970 +0000
870 date: Thu Jan 01 00:00:22 1970 +0000
871 summary: ab
871 summary: ab
872
872
873 diff --git a/subdir/f1 b/subdir/f1
873 diff --git a/subdir/f1 b/subdir/f1
874 old mode 100755
874 old mode 100755
875 new mode 100644
875 new mode 100644
876 --- a/subdir/f1
876 --- a/subdir/f1
877 +++ b/subdir/f1
877 +++ b/subdir/f1
878 @@ -2,3 +2,4 @@
878 @@ -2,3 +2,4 @@
879 a
879 a
880 a
880 a
881 b
881 b
882 +c
882 +c
883
883
884
884
885 $ cd ..
885 $ cd ..
886
886
887 Abort early when a merge is in progress
887 Abort early when a merge is in progress
888
888
889 $ hg up 4
889 $ hg up 4
890 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
890 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
891
891
892 $ touch iwillmergethat
892 $ touch iwillmergethat
893 $ hg add iwillmergethat
893 $ hg add iwillmergethat
894
894
895 $ hg branch thatbranch
895 $ hg branch thatbranch
896 marked working directory as branch thatbranch
896 marked working directory as branch thatbranch
897
897
898 $ hg ci -m'new head'
898 $ hg ci -m'new head'
899
899
900 $ hg up default
900 $ hg up default
901 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
901 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
902
902
903 $ hg merge thatbranch
903 $ hg merge thatbranch
904 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
904 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
905 (branch merge, don't forget to commit)
905 (branch merge, don't forget to commit)
906
906
907 $ hg record -m'will abort'
907 $ hg record -m'will abort'
908 abort: cannot partially commit a merge (use "hg commit" instead)
908 abort: cannot partially commit a merge (use "hg commit" instead)
909 [255]
909 [255]
910
910
911 $ hg up -C
911 $ hg up -C
912 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
912 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
913
913
914 With win32text
914 With win32text
915
915
916 $ echo '[extensions]' >> .hg/hgrc
916 $ echo '[extensions]' >> .hg/hgrc
917 $ echo 'win32text = ' >> .hg/hgrc
917 $ echo 'win32text = ' >> .hg/hgrc
918 $ echo '[decode]' >> .hg/hgrc
918 $ echo '[decode]' >> .hg/hgrc
919 $ echo '** = cleverdecode:' >> .hg/hgrc
919 $ echo '** = cleverdecode:' >> .hg/hgrc
920 $ echo '[encode]' >> .hg/hgrc
920 $ echo '[encode]' >> .hg/hgrc
921 $ echo '** = cleverencode:' >> .hg/hgrc
921 $ echo '** = cleverencode:' >> .hg/hgrc
922 $ echo '[patch]' >> .hg/hgrc
922 $ echo '[patch]' >> .hg/hgrc
923 $ echo 'eol = crlf' >> .hg/hgrc
923 $ echo 'eol = crlf' >> .hg/hgrc
924
924
925 Ignore win32text deprecation warning for now:
925 Ignore win32text deprecation warning for now:
926
926
927 $ echo '[win32text]' >> .hg/hgrc
927 $ echo '[win32text]' >> .hg/hgrc
928 $ echo 'warn = no' >> .hg/hgrc
928 $ echo 'warn = no' >> .hg/hgrc
929
929
930 $ echo d >> subdir/f1
930 $ echo d >> subdir/f1
931 $ hg record -d '23 0' -mw1 <<EOF
931 $ hg record -d '23 0' -mw1 <<EOF
932 > y
932 > y
933 > y
933 > y
934 > EOF
934 > EOF
935 diff --git a/subdir/f1 b/subdir/f1
935 diff --git a/subdir/f1 b/subdir/f1
936 1 hunks, 1 lines changed
936 1 hunks, 1 lines changed
937 examine changes to 'subdir/f1'? [Ynsfdaq?]
937 examine changes to 'subdir/f1'? [Ynsfdaq?]
938 @@ -3,3 +3,4 @@
938 @@ -3,3 +3,4 @@
939 a
939 a
940 b
940 b
941 c
941 c
942 +d
942 +d
943 record this change to 'subdir/f1'? [Ynsfdaq?]
943 record this change to 'subdir/f1'? [Ynsfdaq?]
944
944
945 $ hg tip -p
945 $ hg tip -p
946 changeset: 26:b8306e70edc4
946 changeset: 26:b8306e70edc4
947 tag: tip
947 tag: tip
948 parent: 24:0b082130c20a
948 parent: 24:0b082130c20a
949 user: test
949 user: test
950 date: Thu Jan 01 00:00:23 1970 +0000
950 date: Thu Jan 01 00:00:23 1970 +0000
951 summary: w1
951 summary: w1
952
952
953 diff -r 0b082130c20a -r b8306e70edc4 subdir/f1
953 diff -r 0b082130c20a -r b8306e70edc4 subdir/f1
954 --- a/subdir/f1 Thu Jan 01 00:00:22 1970 +0000
954 --- a/subdir/f1 Thu Jan 01 00:00:22 1970 +0000
955 +++ b/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
955 +++ b/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
956 @@ -3,3 +3,4 @@
956 @@ -3,3 +3,4 @@
957 a
957 a
958 b
958 b
959 c
959 c
960 +d
960 +d
961
961
General Comments 0
You need to be logged in to leave comments. Login now