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