Mercurial > hg
comparison tests/test-shelve.t @ 46246:416ecdaa12df
patch: handle filenames with trailing spaces
I have no idea if this is *actually* supported by the patch file format, but at
least when reading from a patch file created by running `hg shelve`, it is
written out such that there's a trailing space after the second (`b`) filename.
When we read the patch file, we remove the space before parsing the filenames,
so it doesn't end up matching the other sources of what files are in the shelve.
We observed this internally due to a wrapper around unshelve that called into
patch.changedfiles, but `hg patch` is able to reproduce the issue as well, so
I've included both tests.
Differential Revision: https://phab.mercurial-scm.org/D9729
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Mon, 11 Jan 2021 17:46:55 -0800 |
parents | 073bb7563931 |
children | a68d3386138c |
comparison
equal
deleted
inserted
replaced
46245:db2bc9e667a1 | 46246:416ecdaa12df |
---|---|
1510 | 1510 |
1511 -- test for --interactive --keep | 1511 -- test for --interactive --keep |
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 |