##// END OF EJS Templates
import: abort instead of crashing when copy source does not exist (issue5375)...
Ryan McElroy -
r30078:173bdb50 default
parent child Browse files
Show More
@@ -1952,8 +1952,10 b' def _applydiff(ui, fp, patcher, backend,'
1952 data, mode = None, None
1952 data, mode = None, None
1953 if gp.op in ('RENAME', 'COPY'):
1953 if gp.op in ('RENAME', 'COPY'):
1954 data, mode = store.getfile(gp.oldpath)[:2]
1954 data, mode = store.getfile(gp.oldpath)[:2]
1955 # FIXME: failing getfile has never been handled here
1955 if data is None:
1956 assert data is not None
1956 # This means that the old path does not exist
1957 raise PatchError(_("source file '%s' does not exist")
1958 % gp.oldpath)
1957 if gp.mode:
1959 if gp.mode:
1958 mode = gp.mode
1960 mode = gp.mode
1959 if gp.op == 'ADD':
1961 if gp.op == 'ADD':
@@ -1793,3 +1793,13 b' repository when file not found for patch'
1793 1 out of 1 hunks FAILED -- saving rejects to file file1.rej
1793 1 out of 1 hunks FAILED -- saving rejects to file file1.rej
1794 abort: patch failed to apply
1794 abort: patch failed to apply
1795 [255]
1795 [255]
1796
1797 test import crash (issue5375)
1798 $ cd ..
1799 $ hg init repo
1800 $ cd repo
1801 $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import -
1802 applying patch from stdin
1803 a not tracked!
1804 abort: source file 'a' does not exist
1805 [255]
General Comments 0
You need to be logged in to leave comments. Login now