sapling/tests/test-edit-tmp.t
Xavier Deguillard 53b7917b09 ui: handle folder in .hg/edit-tmp at commit time
Summary:
We had a user that had a folder created in .hg/edit-tmp, this prevented them
from commiting their work as `hg commit` would crash due to the folder. Let's
handle this case.

Reviewed By: quark-zju

Differential Revision: D15857754

fbshipit-source-id: 087096f3c14ca2ac490ae1af20651abc813df8f3
2019-06-17 13:24:01 -07:00

34 lines
726 B
Perl

$ newrepo
$ setconfig ui.allowemptycommit=1
$ enable amend
$ HGEDITOR=true hg commit -m 1 -e
$ HGEDITOR=true hg commit --amend -m 2 -e
$ HGEDITOR='echo 3 >' hg metaedit
All 3 files are here:
$ python << EOF
> import os
> names = os.listdir('.hg/edit-tmp')
> print(names)
> for name in names:
> os.utime(os.path.join('.hg/edit-tmp', name), (0, 0))
> EOF
['*', '*', '*'] (glob)
$ HGEDITOR=true hg commit -m 4 -e
Those files will be cleaned up since they have ancient mtime:
$ python << EOF
> import os
> print(os.listdir('.hg/edit-tmp'))
> EOF
['*'] (glob)
Verify that a folder in .hg/edit-tmp doesn't crash hg:
$ mkdir .hg/edit-tmp/foo
$ HGEDITOR=true hg commit -m 5 -e