##// END OF EJS Templates
transplant: handle non-empty patches doing nothing (issue2806)...
Patrick Mezard -
r17319:a189d447 stable
parent child Browse files
Show More
@@ -263,9 +263,6 b' class transplanter(object):'
263 files = set()
263 files = set()
264 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
264 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
265 files = list(files)
265 files = list(files)
266 if not files:
267 self.ui.warn(_('%s: empty changeset') % revlog.hex(node))
268 return None
269 except Exception, inst:
266 except Exception, inst:
270 seriespath = os.path.join(self.path, 'series')
267 seriespath = os.path.join(self.path, 'series')
271 if os.path.exists(seriespath):
268 if os.path.exists(seriespath):
@@ -288,14 +285,8 b' class transplanter(object):'
288 n = repo.commit(message, user, date, extra=extra, match=m,
285 n = repo.commit(message, user, date, extra=extra, match=m,
289 editor=self.editor)
286 editor=self.editor)
290 if not n:
287 if not n:
291 # Crash here to prevent an unclear crash later, in
288 self.ui.warn(_('%s: empty changeset') % revlog.hex(node))
292 # transplants.write(). This can happen if patch.patch()
289 return None
293 # does nothing but claims success or if repo.status() fails
294 # to report changes done by patch.patch(). These both
295 # appear to be bugs in other parts of Mercurial, but dying
296 # here, as soon as we can detect the problem, is preferable
297 # to silently dropping changesets on the floor.
298 raise RuntimeError('nothing committed after transplant')
299 if not merge:
290 if not merge:
300 self.transplants.set(n, node)
291 self.transplants.set(n, node)
301
292
@@ -603,3 +603,32 b' test transplant with merge changeset acc'
603 applying be9f9b39483f
603 applying be9f9b39483f
604 be9f9b39483f transplanted to 9959e51f94d1
604 be9f9b39483f transplanted to 9959e51f94d1
605 $ cd ..
605 $ cd ..
606
607 test transplanting a patch turning into a no-op
608
609 $ hg init binarysource
610 $ cd binarysource
611 $ echo a > a
612 $ hg ci -Am adda a
613 >>> file('b', 'wb').write('\0b1')
614 $ hg ci -Am addb b
615 >>> file('b', 'wb').write('\0b2')
616 $ hg ci -m changeb b
617 $ cd ..
618
619 $ hg clone -r0 binarysource binarydest
620 adding changesets
621 adding manifests
622 adding file changes
623 added 1 changesets with 1 changes to 1 files
624 updating to branch default
625 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
626 $ cd binarydest
627 $ cp ../binarysource/b b
628 $ hg ci -Am addb2 b
629 $ hg transplant -s ../binarysource 2
630 searching for changes
631 applying 7a7d57e15850
632 7a7d57e158501e51588f5fd3288b491cac77e0d8: empty changeset (no-eol)
633 $ cd ..
634
General Comments 0
You need to be logged in to leave comments. Login now