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