Show More
@@ -264,18 +264,19 b' class queue(object):' | |||||
264 | diffopts = self.patchopts(diffopts, patchfn) |
|
264 | diffopts = self.patchopts(diffopts, patchfn) | |
265 | return diffopts |
|
265 | return diffopts | |
266 |
|
266 | |||
267 |
def patchopts(self, diffopts, |
|
267 | def patchopts(self, diffopts, *patches): | |
268 | """Return a copy of input diff options with git set to true if |
|
268 | """Return a copy of input diff options with git set to true if | |
269 | referenced patch is a git patch. |
|
269 | referenced patch is a git patch. | |
270 | """ |
|
270 | """ | |
271 | diffopts = diffopts.copy() |
|
271 | diffopts = diffopts.copy() | |
272 | patchf = self.opener(patchfn, 'r') |
|
272 | for patchfn in patches: | |
273 | # if the patch was a git patch, refresh it as a git patch |
|
273 | patchf = self.opener(patchfn, 'r') | |
274 | for line in patchf: |
|
274 | # if the patch was a git patch, refresh it as a git patch | |
275 | if line.startswith('diff --git'): |
|
275 | for line in patchf: | |
276 | diffopts.git = True |
|
276 | if line.startswith('diff --git'): | |
277 |
|
|
277 | diffopts.git = True | |
278 | patchf.close() |
|
278 | break | |
|
279 | patchf.close() | |||
279 | return diffopts |
|
280 | return diffopts | |
280 |
|
281 | |||
281 | def join(self, *p): |
|
282 | def join(self, *p): | |
@@ -2070,7 +2071,8 b' def fold(ui, repo, *files, **opts):' | |||||
2070 | if opts['edit']: |
|
2071 | if opts['edit']: | |
2071 | message = ui.edit(message, user or ui.username()) |
|
2072 | message = ui.edit(message, user or ui.username()) | |
2072 |
|
2073 | |||
2073 | q.refresh(repo, msg=message) |
|
2074 | diffopts = q.patchopts(q.diffopts(), *patches) | |
|
2075 | q.refresh(repo, msg=message, git=diffopts.git) | |||
2074 | q.delete(repo, patches, opts) |
|
2076 | q.delete(repo, patches, opts) | |
2075 | q.save_dirty() |
|
2077 | q.save_dirty() | |
2076 |
|
2078 |
@@ -25,12 +25,35 b" echo '% fold in the middle of the queue'" | |||||
25 | hg qpop p1 |
|
25 | hg qpop p1 | |
26 | hg qdiff | filterdiff |
|
26 | hg qdiff | filterdiff | |
27 | hg qfold p2 |
|
27 | hg qfold p2 | |
|
28 | grep git .hg/patches/p1 && echo 'git patch found!' | |||
28 | hg qser |
|
29 | hg qser | |
29 | hg qdiff | filterdiff |
|
30 | hg qdiff | filterdiff | |
30 | echo '% fold with local changes' |
|
31 | echo '% fold with local changes' | |
31 | echo d >> a |
|
32 | echo d >> a | |
32 | hg qfold p3 |
|
33 | hg qfold p3 | |
33 | hg diff -c . | filterdiff |
|
34 | hg diff -c . | filterdiff | |
|
35 | hg revert -a --no-backup | |||
|
36 | ||||
|
37 | echo '% fold git patch into a regular patch, expect git patch' | |||
|
38 | echo a >> a | |||
|
39 | hg qnew -f regular | |||
|
40 | hg cp a aa | |||
|
41 | hg qnew --git -f git | |||
|
42 | hg qpop | |||
|
43 | hg qfold git | |||
|
44 | cat .hg/patches/regular | |||
|
45 | hg qpop | |||
|
46 | hg qdel regular | |||
|
47 | ||||
|
48 | echo '% fold regular patch into a git patch, expect git patch' | |||
|
49 | hg cp a aa | |||
|
50 | hg qnew --git -f git | |||
|
51 | echo b >> aa | |||
|
52 | hg qnew -f regular | |||
|
53 | hg qpop | |||
|
54 | hg qfold regular | |||
|
55 | cat .hg/patches/git | |||
|
56 | ||||
34 | cd .. |
|
57 | cd .. | |
35 |
|
58 | |||
36 |
|
59 |
@@ -25,3 +25,40 b' abort: local changes found, refresh firs' | |||||
25 | a |
|
25 | a | |
26 | +a |
|
26 | +a | |
27 | +b |
|
27 | +b | |
|
28 | reverting a | |||
|
29 | % fold git patch into a regular patch, expect git patch | |||
|
30 | popping git | |||
|
31 | now at: regular | |||
|
32 | diff --git a/a b/a | |||
|
33 | --- a/a | |||
|
34 | +++ b/a | |||
|
35 | @@ -1,3 +1,4 @@ | |||
|
36 | a | |||
|
37 | a | |||
|
38 | b | |||
|
39 | +a | |||
|
40 | diff --git a/a b/aa | |||
|
41 | copy from a | |||
|
42 | copy to aa | |||
|
43 | --- a/a | |||
|
44 | +++ b/aa | |||
|
45 | @@ -1,3 +1,4 @@ | |||
|
46 | a | |||
|
47 | a | |||
|
48 | b | |||
|
49 | +a | |||
|
50 | popping regular | |||
|
51 | now at: p1 | |||
|
52 | % fold regular patch into a git patch, expect git patch | |||
|
53 | popping regular | |||
|
54 | now at: git | |||
|
55 | diff --git a/a b/aa | |||
|
56 | copy from a | |||
|
57 | copy to aa | |||
|
58 | --- a/a | |||
|
59 | +++ b/aa | |||
|
60 | @@ -1,3 +1,4 @@ | |||
|
61 | a | |||
|
62 | a | |||
|
63 | b | |||
|
64 | +b |
General Comments 0
You need to be logged in to leave comments.
Login now