Show More
@@ -59,8 +59,6 b' def recordfilter(ui, originalhunks):' | |||||
59 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, |
|
59 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, | |
60 | filterfn, *pats, **opts): |
|
60 | filterfn, *pats, **opts): | |
61 | import merge as mergemod |
|
61 | import merge as mergemod | |
62 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) |
|
|||
63 | ishunk = lambda x: isinstance(x, hunkclasses) |
|
|||
64 |
|
62 | |||
65 | if not ui.interactive(): |
|
63 | if not ui.interactive(): | |
66 | raise util.Abort(_('running non-interactively, use %s instead') % |
|
64 | raise util.Abort(_('running non-interactively, use %s instead') % | |
@@ -117,12 +115,6 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
117 | ui.status(_('no changes to record\n')) |
|
115 | ui.status(_('no changes to record\n')) | |
118 | return 0 |
|
116 | return 0 | |
119 |
|
117 | |||
120 | newandmodifiedfiles = set() |
|
|||
121 | for h in chunks: |
|
|||
122 | isnew = h.filename() in status.added |
|
|||
123 | if ishunk(h) and isnew and not h in originalchunks: |
|
|||
124 | newandmodifiedfiles.add(h.filename()) |
|
|||
125 |
|
||||
126 | modified = set(status.modified) |
|
118 | modified = set(status.modified) | |
127 |
|
119 | |||
128 | # 2. backup changed files, so we can restore them in the end |
|
120 | # 2. backup changed files, so we can restore them in the end | |
@@ -130,8 +122,7 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
130 | if backupall: |
|
122 | if backupall: | |
131 | tobackup = changed |
|
123 | tobackup = changed | |
132 | else: |
|
124 | else: | |
133 | tobackup = [f for f in newfiles |
|
125 | tobackup = [f for f in newfiles if f in modified] | |
134 | if f in modified or f in newandmodifiedfiles] |
|
|||
135 |
|
126 | |||
136 | backups = {} |
|
127 | backups = {} | |
137 | if tobackup: |
|
128 | if tobackup: | |
@@ -155,13 +146,11 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
155 | fp = cStringIO.StringIO() |
|
146 | fp = cStringIO.StringIO() | |
156 | for c in chunks: |
|
147 | for c in chunks: | |
157 | fname = c.filename() |
|
148 | fname = c.filename() | |
158 |
if fname in backups |
|
149 | if fname in backups: | |
159 | c.write(fp) |
|
150 | c.write(fp) | |
160 | dopatch = fp.tell() |
|
151 | dopatch = fp.tell() | |
161 | fp.seek(0) |
|
152 | fp.seek(0) | |
162 |
|
153 | |||
163 | [os.unlink(c) for c in newandmodifiedfiles] |
|
|||
164 |
|
||||
165 | # 3a. apply filtered patch to clean repo (clean) |
|
154 | # 3a. apply filtered patch to clean repo (clean) | |
166 | if backups: |
|
155 | if backups: | |
167 | # Equivalent to hg.revert |
|
156 | # Equivalent to hg.revert |
@@ -820,7 +820,7 b' class header(object):' | |||||
820 | """ |
|
820 | """ | |
821 | diffgit_re = re.compile('diff --git a/(.*) b/(.*)$') |
|
821 | diffgit_re = re.compile('diff --git a/(.*) b/(.*)$') | |
822 | diff_re = re.compile('diff -r .* (.*)$') |
|
822 | diff_re = re.compile('diff -r .* (.*)$') | |
823 | allhunks_re = re.compile('(?:index|deleted file) ') |
|
823 | allhunks_re = re.compile('(?:index|new file|deleted file) ') | |
824 | pretty_re = re.compile('(?:new file|deleted file) ') |
|
824 | pretty_re = re.compile('(?:new file|deleted file) ') | |
825 | special_re = re.compile('(?:index|new|deleted|copy|rename) ') |
|
825 | special_re = re.compile('(?:index|new|deleted|copy|rename) ') | |
826 |
|
826 |
@@ -143,48 +143,10 b' Committing only one hunk' | |||||
143 | 10 |
|
143 | 10 | |
144 | y |
|
144 | y | |
145 |
|
145 | |||
146 | Editing patch of newly added file |
|
|||
147 |
|
||||
148 | $ cat > editor.sh << '__EOF__' |
|
|||
149 | > cat "$1" | sed "s/first/very/g" > tt |
|
|||
150 | > mv tt "$1" |
|
|||
151 | > __EOF__ |
|
|||
152 | $ cat > newfile << '__EOF__' |
|
|||
153 | > This is the first line |
|
|||
154 | > This is the second line |
|
|||
155 | > This is the third line |
|
|||
156 | > __EOF__ |
|
|||
157 | $ hg add newfile |
|
|||
158 | $ cat <<EOF >testModeCommands |
|
|||
159 | > f |
|
|||
160 | > KEY_DOWN |
|
|||
161 | > KEY_DOWN |
|
|||
162 | > KEY_DOWN |
|
|||
163 | > e |
|
|||
164 | > X |
|
|||
165 | > EOF |
|
|||
166 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new |
|
|||
167 | $ hg tip |
|
|||
168 | changeset: 4:6a0a43e9eff5 |
|
|||
169 | tag: tip |
|
|||
170 | user: test |
|
|||
171 | date: Thu Jan 01 00:00:23 1970 +0000 |
|
|||
172 | summary: edit-patch-new |
|
|||
173 |
|
||||
174 | $ hg cat -r tip newfile |
|
|||
175 | This is the very line |
|
|||
176 | This is the second line |
|
|||
177 | This is the third line |
|
|||
178 |
|
||||
179 | $ cat newfile |
|
|||
180 | This is the first line |
|
|||
181 | This is the second line |
|
|||
182 | This is the third line |
|
|||
183 |
|
||||
184 | Newly added files can be selected with the curses interface |
|
146 | Newly added files can be selected with the curses interface | |
185 |
|
147 | |||
186 | $ hg update -C . |
|
148 | $ hg update -C . | |
187 |
|
|
149 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
188 | $ echo "hello" > x |
|
150 | $ echo "hello" > x | |
189 | $ hg add x |
|
151 | $ hg add x | |
190 | $ cat <<EOF >testModeCommands |
|
152 | $ cat <<EOF >testModeCommands | |
@@ -194,10 +156,8 b' Newly added files can be selected with t' | |||||
194 | > EOF |
|
156 | > EOF | |
195 | $ hg st |
|
157 | $ hg st | |
196 | A x |
|
158 | A x | |
197 | ? editor.sh |
|
|||
198 | ? testModeCommands |
|
159 | ? testModeCommands | |
199 | $ hg commit -i -m "newly added file" -d "0 0" |
|
160 | $ hg commit -i -m "newly added file" -d "0 0" | |
200 | $ hg st |
|
161 | $ hg st | |
201 | ? editor.sh |
|
|||
202 | ? testModeCommands |
|
162 | ? testModeCommands | |
203 |
|
163 |
@@ -229,25 +229,11 b' Add plain file' | |||||
229 | $ hg add plain |
|
229 | $ hg add plain | |
230 | $ hg commit -i -d '7 0' -m plain plain<<EOF |
|
230 | $ hg commit -i -d '7 0' -m plain plain<<EOF | |
231 | > y |
|
231 | > y | |
232 | > y |
|
|||
233 | > EOF |
|
232 | > EOF | |
234 | diff --git a/plain b/plain |
|
233 | diff --git a/plain b/plain | |
235 | new file mode 100644 |
|
234 | new file mode 100644 | |
236 | examine changes to 'plain'? [Ynesfdaq?] y |
|
235 | examine changes to 'plain'? [Ynesfdaq?] y | |
237 |
|
236 | |||
238 | @@ -0,0 +1,10 @@ |
|
|||
239 | +1 |
|
|||
240 | +2 |
|
|||
241 | +3 |
|
|||
242 | +4 |
|
|||
243 | +5 |
|
|||
244 | +6 |
|
|||
245 | +7 |
|
|||
246 | +8 |
|
|||
247 | +9 |
|
|||
248 | +10 |
|
|||
249 | record this change to 'plain'? [Ynesfdaq?] y |
|
|||
250 |
|
||||
251 | $ hg tip -p |
|
237 | $ hg tip -p | |
252 | changeset: 7:11fb457c1be4 |
|
238 | changeset: 7:11fb457c1be4 | |
253 | tag: tip |
|
239 | tag: tip | |
@@ -348,10 +334,6 b' Modify end of plain file, add EOL' | |||||
348 | new file mode 100644 |
|
334 | new file mode 100644 | |
349 | examine changes to 'plain2'? [Ynesfdaq?] y |
|
335 | examine changes to 'plain2'? [Ynesfdaq?] y | |
350 |
|
336 | |||
351 | @@ -0,0 +1,1 @@ |
|
|||
352 | +1 |
|
|||
353 | record change 2/2 to 'plain2'? [Ynesfdaq?] y |
|
|||
354 |
|
||||
355 | Modify beginning, trim end, record both, add another file to test |
|
337 | Modify beginning, trim end, record both, add another file to test | |
356 | changes numbering |
|
338 | changes numbering | |
357 |
|
339 | |||
@@ -1395,40 +1377,34 b' Test --user when ui.username not set' | |||||
1395 | $ export HGUSER |
|
1377 | $ export HGUSER | |
1396 |
|
1378 | |||
1397 |
|
1379 | |||
1398 | Editing patch of newly added file |
|
1380 | Moving files | |
1399 |
|
1381 | |||
1400 | $ cat > editor.sh << '__EOF__' |
|
1382 | $ hg update -C . | |
1401 | > cat "$1" | sed "s/first/very/g" > tt |
|
1383 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1402 | > mv tt "$1" |
|
1384 | $ hg mv plain plain3 | |
1403 | > __EOF__ |
|
1385 | $ echo somechange >> plain3 | |
1404 | $ cat > newfile << '__EOF__' |
|
1386 | $ hg commit -i -d '23 0' -mmoving_files << EOF | |
1405 | > This is the first line |
|
|||
1406 | > This is the second line |
|
|||
1407 | > This is the third line |
|
|||
1408 | > __EOF__ |
|
|||
1409 | $ hg add newfile |
|
|||
1410 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-new <<EOF |
|
|||
1411 | > y |
|
1387 | > y | |
1412 |
> |
|
1388 | > y | |
1413 | > EOF |
|
1389 | > EOF | |
1414 |
diff --git a/ |
|
1390 | diff --git a/plain b/plain3 | |
1415 | new file mode 100644 |
|
1391 | rename from plain | |
1416 | examine changes to 'newfile'? [Ynesfdaq?] y |
|
1392 | rename to plain3 | |
1417 |
|
1393 | 1 hunks, 1 lines changed | ||
1418 | @@ -0,0 +1,3 @@ |
|
1394 | examine changes to 'plain' and 'plain3'? [Ynesfdaq?] y | |
1419 | +This is the first line |
|
|||
1420 | +This is the second line |
|
|||
1421 | +This is the third line |
|
|||
1422 | record this change to 'newfile'? [Ynesfdaq?] e |
|
|||
1423 |
|
1395 | |||
1424 | $ hg cat -r tip newfile |
|
1396 | @@ -11,3 +11,4 @@ | |
1425 | This is the very line |
|
1397 | 9 | |
1426 | This is the second line |
|
1398 | 10 | |
1427 | This is the third line |
|
1399 | 11 | |
1428 |
|
1400 | +somechange | ||
1429 | $ cat newfile |
|
1401 | record this change to 'plain3'? [Ynesfdaq?] y | |
1430 | This is the first line |
|
1402 | ||
1431 | This is the second line |
|
1403 | $ hg tip | |
1432 | This is the third line |
|
1404 | changeset: 30:542e1f362a22 | |
1433 |
|
1405 | tag: tip | ||
|
1406 | user: test | |||
|
1407 | date: Thu Jan 01 00:00:23 1970 +0000 | |||
|
1408 | summary: moving_files | |||
|
1409 | ||||
1434 | $ cd .. |
|
1410 | $ cd .. |
@@ -479,12 +479,6 b' record added file alone' | |||||
479 | new file mode 100644 |
|
479 | new file mode 100644 | |
480 | examine changes to 'r'? [Ynesfdaq?] y |
|
480 | examine changes to 'r'? [Ynesfdaq?] y | |
481 |
|
481 | |||
482 | @@ -0,0 +1,1 @@ |
|
|||
483 | +$Id$ |
|
|||
484 | record this change to 'r'? [Ynesfdaq?] y |
|
|||
485 |
|
||||
486 | resolving manifests |
|
|||
487 | patching file r |
|
|||
488 |
|
|
482 | committing files: | |
489 | r |
|
483 | r | |
490 | committing manifest |
|
484 | committing manifest | |
@@ -513,12 +507,6 b' record added keyword ignored file' | |||||
513 | new file mode 100644 |
|
507 | new file mode 100644 | |
514 | examine changes to 'i'? [Ynesfdaq?] y |
|
508 | examine changes to 'i'? [Ynesfdaq?] y | |
515 |
|
509 | |||
516 | @@ -0,0 +1,1 @@ |
|
|||
517 | +$Id$ |
|
|||
518 | record this change to 'i'? [Ynesfdaq?] y |
|
|||
519 |
|
||||
520 | resolving manifests |
|
|||
521 | patching file i |
|
|||
522 |
|
|
510 | committing files: | |
523 | i |
|
511 | i | |
524 | committing manifest |
|
512 | committing manifest |
@@ -295,11 +295,6 b' handle subrepos safely on qrecord' | |||||
295 | new file mode 100644 |
|
295 | new file mode 100644 | |
296 | examine changes to '.hgsub'? [Ynesfdaq?] y |
|
296 | examine changes to '.hgsub'? [Ynesfdaq?] y | |
297 |
|
297 | |||
298 | @@ -0,0 +1,1 @@ |
|
|||
299 | +sub = sub |
|
|||
300 | record this change to '.hgsub'? [Ynesfdaq?] y |
|
|||
301 |
|
||||
302 | warning: subrepo spec file '.hgsub' not found |
|
|||
303 | abort: uncommitted changes in subrepository 'sub' |
|
298 | abort: uncommitted changes in subrepository 'sub' | |
304 | [255] |
|
299 | [255] | |
305 | % update substate when adding .hgsub w/clean updated subrepo |
|
300 | % update substate when adding .hgsub w/clean updated subrepo | |
@@ -309,11 +304,6 b' handle subrepos safely on qrecord' | |||||
309 | new file mode 100644 |
|
304 | new file mode 100644 | |
310 | examine changes to '.hgsub'? [Ynesfdaq?] y |
|
305 | examine changes to '.hgsub'? [Ynesfdaq?] y | |
311 |
|
306 | |||
312 | @@ -0,0 +1,1 @@ |
|
|||
313 | +sub = sub |
|
|||
314 | record this change to '.hgsub'? [Ynesfdaq?] y |
|
|||
315 |
|
||||
316 | warning: subrepo spec file '.hgsub' not found |
|
|||
317 | path sub |
|
307 | path sub | |
318 | source sub |
|
308 | source sub | |
319 | revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31 |
|
309 | revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31 |
General Comments 0
You need to be logged in to leave comments.
Login now