[PATCH V2] update: warn if cwd was deleted
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Sep 6 16:01:25 UTC 2016
On 09/06/2016 06:00 PM, Kevin Bullock wrote:
>> On Sep 2, 2016, at 15:43, Stanislau Hlebik <stash at fb.com> wrote:
>>
>> # HG changeset patch
>> # User Stanislau Hlebik <stash at fb.com>
>> # Date 1472848944 25200
>> # Fri Sep 02 13:42:24 2016 -0700
>> # Node ID 374caff3f6ba064070d01329eec1bd33a6a45370
>> # Parent 318e2b600b80e4ed3c6f37df46ec7544f60d4c0b
>> update: warn if cwd was deleted
>>
>> During update directories are deleted as soon as they have no entries.
>> But if current working directory is deleted then it cause problems
>> in complex commands like 'hg split'. This commit adds a warning
>> that will help users figure the problem faster.
>>
>> diff --git a/mercurial/merge.py b/mercurial/merge.py
>> --- a/mercurial/merge.py
>> +++ b/mercurial/merge.py
>> @@ -1043,7 +1043,19 @@
>> repo.ui.note(_("removing %s\n") % f)
>> audit(f)
>> try:
>> - unlink(wjoin(f), ignoremissing=True)
>> + try:
>> + cwd = os.getcwd()
>> + except OSError:
>> + cwd = None
>> + path = wjoin(f)
>> + unlink(path, ignoremissing=True)
>> + try:
>> + os.getcwd()
>> + except OSError:
>> + # Print a warning if cwd was deleted
>> + if cwd and path.startswith(cwd):
>> + repo.ui.warn(_("cwd was deleted - consider "
>> + "changing cwd to repo root\n"))
>
> I'd much rather have "current working directory" spelled out. Not all users are going to be familiar with Unix's often questionably-sensible abbreviations for things.
+1
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list