##// END OF EJS Templates
patch: handle filenames with trailing spaces...
Kyle Lippincott -
r46863:416ecdaa default
parent child Browse files
Show More
@@ -393,7 +393,7 b' def readgitpatch(lr):'
393 gp = None
393 gp = None
394 gitpatches = []
394 gitpatches = []
395 for line in lr:
395 for line in lr:
396 line = line.rstrip(b' \r\n')
396 line = line.rstrip(b'\r\n')
397 if line.startswith(b'diff --git a/'):
397 if line.startswith(b'diff --git a/'):
398 m = gitre.match(line)
398 m = gitre.match(line)
399 if m:
399 if m:
@@ -2073,7 +2073,7 b' def iterhunks(fp):'
2073 yield b'file', (afile, bfile, h, gp and gp.copy() or None)
2073 yield b'file', (afile, bfile, h, gp and gp.copy() or None)
2074 yield b'hunk', h
2074 yield b'hunk', h
2075 elif x.startswith(b'diff --git a/'):
2075 elif x.startswith(b'diff --git a/'):
2076 m = gitre.match(x.rstrip(b' \r\n'))
2076 m = gitre.match(x.rstrip(b'\r\n'))
2077 if not m:
2077 if not m:
2078 continue
2078 continue
2079 if gitpatches is None:
2079 if gitpatches is None:
@@ -1512,3 +1512,26 b' Abort unshelve while merging (issue5123)'
1512 $ hg unshelve -i --keep
1512 $ hg unshelve -i --keep
1513 abort: --keep on --interactive is not yet supported
1513 abort: --keep on --interactive is not yet supported
1514 [255]
1514 [255]
1515
1516 $ hg update -q --clean .
1517
1518 Test that we can successfully shelve and unshelve a file with a trailing space
1519 in the filename. Such filenames are supposedly unsupported on Windows, so we
1520 wrap it in the no-windows check. Also test `hg patch` of the .patch file
1521 produced by `hg shelve`.
1522 #if no-windows
1523 $ echo hi > 'my filename '
1524 $ hg add 'my filename '
1525 warning: filename ends with ' ', which is not allowed on Windows: 'my filename '
1526 $ hg shelve
1527 shelved as default-01
1528 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1529 $ cp .hg/shelved/default-01.patch test_patch.patch
1530 $ hg unshelve
1531 unshelving change 'default-01'
1532 $ cat 'my filename '
1533 hi
1534 $ hg update -q --clean .
1535 $ hg patch -p1 test_patch.patch
1536 applying test_patch.patch
1537 #endif
General Comments 0
You need to be logged in to leave comments. Login now