##// END OF EJS Templates
merge with stable
Matt Mackall -
r13104:5dac0d04 merge default
parent child Browse files
Show More
@@ -44,8 +44,14 b' def write(repo):'
44 can be copied back on rollback.
44 can be copied back on rollback.
45 '''
45 '''
46 refs = repo._bookmarks
46 refs = repo._bookmarks
47 if os.path.exists(repo.join('bookmarks')):
47
48 util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
48 try:
49 bms = repo.opener('bookmarks').read()
50 except IOError:
51 bms = None
52 if bms is not None:
53 repo.opener('undo.bookmarks', 'w').write(bms)
54
49 if repo._bookmarkcurrent not in refs:
55 if repo._bookmarkcurrent not in refs:
50 setcurrent(repo, None)
56 setcurrent(repo, None)
51 wlock = repo.wlock()
57 wlock = repo.wlock()
@@ -70,6 +70,8 b' class tarit(object):'
70 self.fileobj.write('\010') # compression method
70 self.fileobj.write('\010') # compression method
71 # Python 2.6 deprecates self.filename
71 # Python 2.6 deprecates self.filename
72 fname = getattr(self, 'name', None) or self.filename
72 fname = getattr(self, 'name', None) or self.filename
73 if fname and fname.endswith('.gz'):
74 fname = fname[:-3]
73 flags = 0
75 flags = 0
74 if fname:
76 if fname:
75 flags = gzip.FNAME
77 flags = gzip.FNAME
@@ -485,6 +485,15 b' class patchfile(object):'
485 for x, s in enumerate(self.lines):
485 for x, s in enumerate(self.lines):
486 self.hash.setdefault(s, []).append(x)
486 self.hash.setdefault(s, []).append(x)
487
487
488 def makerejlines(self, fname):
489 base = os.path.basename(fname)
490 yield "--- %s\n+++ %s\n" % (base, base)
491 for x in self.rej:
492 for l in x.hunk:
493 yield l
494 if l[-1] != '\n':
495 yield "\n\ No newline at end of file\n"
496
488 def write_rej(self):
497 def write_rej(self):
489 # our rejects are a little different from patch(1). This always
498 # our rejects are a little different from patch(1). This always
490 # creates rejects in the same form as the original patch. A file
499 # creates rejects in the same form as the original patch. A file
@@ -499,16 +508,9 b' class patchfile(object):'
499 _("%d out of %d hunks FAILED -- saving rejects to file %s\n") %
508 _("%d out of %d hunks FAILED -- saving rejects to file %s\n") %
500 (len(self.rej), self.hunks, fname))
509 (len(self.rej), self.hunks, fname))
501
510
502 def rejlines():
511 fp = self.opener(fname, 'w')
503 base = os.path.basename(self.fname)
512 fp.writelines(self.makerejlines(self.fname))
504 yield "--- %s\n+++ %s\n" % (base, base)
513 fp.close()
505 for x in self.rej:
506 for l in x.hunk:
507 yield l
508 if l[-1] != '\n':
509 yield "\n\ No newline at end of file\n"
510
511 self.writelines(fname, rejlines())
512
514
513 def apply(self, h):
515 def apply(self, h):
514 if not h.complete():
516 if not h.complete():
@@ -141,3 +141,67 b' push again without LF and compare revisi'
141 $ hg qpop
141 $ hg qpop
142 popping eol.diff
142 popping eol.diff
143 patch queue now empty
143 patch queue now empty
144 $ cd ..
145
146
147 Test .rej file EOL are left unchanged
148
149 $ hg init testeol
150 $ cd testeol
151 $ python -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
152 $ hg ci -Am adda
153 adding a
154 $ python -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
155 $ hg qnew patch1
156 $ hg qpop
157 popping patch1
158 patch queue now empty
159 $ python -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
160 $ hg ci -m changea
161
162 $ hg --config 'patch.eol=LF' qpush
163 applying patch1
164 patching file a
165 Hunk #1 FAILED at 0
166 1 out of 1 hunks FAILED -- saving rejects to file a.rej
167 patch failed, unable to continue (try -v)
168 patch failed, rejects left in working dir
169 errors during apply, please fix and refresh patch1
170 [2]
171 $ hg qpop
172 popping patch1
173 patch queue now empty
174 $ cat a.rej
175 --- a
176 +++ a
177 @@ -1,4 +1,4 @@
178 1\r (esc)
179 2\r (esc)
180 -3\r (esc)
181 +33\r (esc)
182 4
183 \ No newline at end of file
184
185 $ hg --config 'patch.eol=auto' qpush
186 applying patch1
187 patching file a
188 Hunk #1 FAILED at 0
189 1 out of 1 hunks FAILED -- saving rejects to file a.rej
190 patch failed, unable to continue (try -v)
191 patch failed, rejects left in working dir
192 errors during apply, please fix and refresh patch1
193 [2]
194 $ hg qpop
195 popping patch1
196 patch queue now empty
197 $ cat a.rej
198 --- a
199 +++ a
200 @@ -1,4 +1,4 @@
201 1\r (esc)
202 2\r (esc)
203 -3\r (esc)
204 +33\r (esc)
205 4
206 \ No newline at end of file
207 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now