[PATCH 0 of 1 V2] checking for portable filenames

Matt Mackall mpm at selenic.com
Tue Apr 19 10:31:38 CDT 2011


On Tue, 2011-04-19 at 10:09 +0200, Adrian Buehlmann wrote:

> I don't want to lecture you on design, but let me just point out that I
> haven't added any new import in the util module on my original change for
> util, which was:

No, that's definitely true. But layering is not just about imports, it's
about compartmentalizing knowledge. I've pretty carefully kept just
about all knowledge of the upper layers of hg out of util, with only a
few minor exceptions:

- the system command takes an out object with a .write method, which can
thus be a ui or a file
- the recently-introduced checkfilename knows about hg's unhappiness
with newlines in filenames
- path auditor knows about .hg directories being problematic
- the date code knows about hg's internal tuple format
- walkrepos knows about .hg directories

Nothing here knows or cares about ui or repo objects. So what does this
buy us? Without this rule, util would indeed be a dumping ground for
functions of all sorts, expecting ui object, repos, revlogs, manifests,
and whatever. The rule forces care to be given to the genericity of what
gets placed here and limits its scope. 

We've gotten this far without significantly breaking the rule, I don't
see that we've found a reason to start.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list