[PATCH] Check case-folding clashes during addremove

Andrei Vermel andrei.vermel at gmail.com
Mon Apr 16 09:26:35 UTC 2007


>> After a bit of thinking, it seems to me that dirstate.update is not
>> a good place to call the check function, due to the fact that it gets 
>> called
>> with only a single file.
>
> We really want to do these checks only when a file is added (by hg add,
> addremove, copy, move or somebody using python directly).
> dirstate.update feels like the right place for this...
>
> But we could change the callers to call dirstate.update with all the
> files available.  Doing this for localrepo.add shouldn't be hard; for
> copies/moves we'd probably need a new method in localrepo.
Yes, this makes sense.

> Allowing this would open an interesting way for the user to shoot his
> foot by doing
>
> hg mv aaa AAA
> hg commit -m 'case clash' AAA
It's probably worth explicitely requiring that rename pairs get committed
together. I don't think anyone may really want it differently.

>> @@ -268,9 +282,11 @@ class dirstate(object):
>>         if state == "a":
>>             self.initdirs()
>>             self.checkinterfering(files)
>> +            self.check_add_case_clashes(files)
>>         for f in files:
>>             if state == "r":
>>                 self.map[f] = ('r', 0, 0, 0)
>> +                self.add_foldmap(f)
>>                 self.updatedirs(f, -1)
>
> add_foldmap or del_foldmap?
Well spotted. Should be none actually, as f is in the map already, it just 
gets
marked for removal. It is deleted later.

The other comments also seem valid. Thanks for your feedback.

Andrei 




More information about the Mercurial-devel mailing list