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