[PATCH] util: set the hidden attribute on .hg/ during creation on windows (issue4178)

Didly didlybom at gmail.com
Fri Mar 7 19:36:54 CST 2014


On Sat, Mar 8, 2014 at 1:15 AM, Adrian Buehlmann <adrian at cadifra.com> wrote:
> On 2014-03-07 22:54, Matt Mackall wrote:
>> On Fri, 2014-03-07 at 16:10 -0500, Augie Fackler wrote:
>>> On Mar 7, 2014, at 2:43 PM, Matt Mackall <mpm at selenic.com> wrote:
>>>
>>>> On Fri, 2014-02-21 at 16:31 +0000, Ed Morley wrote:
>>>>> # HG changeset patch
>>>>> # User Ed Morley <emorley at mozilla.com>
>>>>> # Date 1392999130 0
>>>>> #      Fri Feb 21 16:12:10 2014 +0000
>>>>> # Node ID e74d0479759cbea6edb632273345d55f96374d70
>>>>> # Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
>>>>> util: set the hidden attribute on .hg/ during creation on windows (issue4178)
>>>>>
>>>>> Windows has no concept of dotfiles/directories being hidden - instead, it
>>>>> requires that a file-is-hidden attribute be set. This patch adds an optional
>>>>> parameter to util.makedir/util.makedirs - which is used to set the hidden
>>>>> attribute when the .hg directory is created on Windows.
>>>>>
>>>>> This has the advantage that both the OS filesystem search & also editors
>>>>> grepping repositories can easily exclude the .hg directory, without needing to
>>>>> exclude it manually every time.
>>>>
>>>> I think 9 years in, this is probably too surprising a change. We could
>>>> have done this out of the gate.. but no one cared enough to even mention
>>>> it for the first 7 years.
>>>
>>> OOC, why? It's already hidden on all other platforms, and that strikes
>>> me as a Good Thing.
>>
>> Why what? Why has basically no one cared to date? I can't answer that.
>>
>> Why is it too big of a surprise? Because suddenly you can't navigate
>> to .hg/hgrc in Explorer and file|open dialogs in editors.
>>
>> More generally, I'd say it's a matter of OS culture. Dealing with hidden
>> files is an everyday situation for typical Unix users, whereas I expect
>> it's a quite rare and surprising occurrence for Windows users. I think
>> if .hg suddenly disappears from new repos, the average Windows dev won't
>> just say "oh, it's probably just hidden now", instead they'll suffer
>> hours/days of confusion.
>>
>> Since we have about two people in all of recorded history asking for it,
>> the cost/benefit does not appear (remotely) favorable.
>
> Perhaps a compromise could be made by setting the hidden flag on
> .hg/store on new repositories...
>
> Regarding the proposed behavior change as by the patch of Ed Morley, I
> think it might indeed be a bit surprising to not see the .hg folder in
> explorer inside new repositories (for users who have not tweaked the
> explorer setting) - given that we now have been used to see .hg on all
> repositories.
>
> As per the culture, a difference can probably be made between developers
> using Windows and other Windows users. I think chances that a typical
> developer has set the "Show hidden files, folders, and drives" setting
> in explorer is pretty high. At least this is one of the few early tweaks
> I make on a fresh Windows install for my personal use.

I agree with Matt and Adrian. I think mercurial windows users have
been "trained" over the years to expect to see an .hg folder at the
root of their repositories. It would be very surprising if this were
no longer the case (plus old repos would have it and new ones would
not?).

Cheers,

Angel


More information about the Mercurial-devel mailing list