This is an archive of the discontinued Mercurial Phabricator instance.

match: use '' instead of '.' for root directory (API)
ClosedPublic

Authored by martinvonz on May 17 2019, 1:57 PM.

Details

Summary

I think '' is generally a better value for the root directory than '.'
is. For example, os.path.join('', 'foo') => 'foo', while
os.path.join('.', 'foo') => './foo'.

This patch mostly makes it so we use '' internally in
match.py. However, it also affects the API in visitdir(),
visitchildrenset() and files(). The two former now also accept '' as
input. I've updated the callers of these methods. I've also added a
deprecation warning for passing '.' (for external callers). The only
caller I could find that was affected by files() returning '' instead
of '.' was in dirstate.walk(). I've updated that.

The next few patches show some workarounds we can remove by using ''
instead of '.'.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped