[PATCH 0 of 9 RFC] manage filename normalization policy per repository

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri May 25 15:00:49 UTC 2012


this patch series allows users to manage filename normalization policy
per repository

this is just for the base of discussion, and tested a little: clone,
bundle/unbundle, archive, diff, export/import.... simply.

basic concepts of this patch series are:

  (1) management of filename normalization are configured like as EOL
      extension:

      - tracked configuration file ".hgnormfn" chooses type of
        normalization (NFC/NFD/none) for data storing

      - filenames are checked at commit/update/merge and so on as like
        case-folding collision detection, according to the configured
        normalization type

        this can prevent users on Linux/Windows from adding files:

          - normalized in the type other than configured one, or
          - colliding against ones normalized in another type

        # this feature is not yet implemented in my patches

  (2) in storage layer and external representation, filenames are
      normalized in chosen style (= "global style"), for portability

      "storage layer" means:
        - manifest file
        - changelog file
        - path to each filelogs

      "external representation" means:
        - bundle file
        - archive file
        - diff (both "hg diff" and "hg export")


  (3) filenames in the on-memory-objects and the working directory are
      always normalized in appropriate style (= "local style"):

      for example, in NFD on MacOS (if this feature is enabled), and
      NFC(or 'none') on Linux/Windows.

      converting on the border between storage layer/external
      representation and on-memory-objects (manifest, context and so
      on) is done

      HFS+ can treat both NFC/NFD form as same file (and tools on
      MacOS, too), so user can write filenames in NFC for (many) tool
      chain configuration files, if they want to use it each on
      MacOS/Linux/Windows

steps to enable this feature are:

    1. enable "hgext.normfn" extension

    2. create ".hgnormfn" under root of the working directory.
       content of it is:

       [normalize]
       type = nfc

    3. add ".hgnormfn" as tracked file

    4. then, commited files are recorded into history with normalized
       name in NFC even on MacOS

the last patch (adding "debug-normfn.py") of this series helps you to
examine this patch series on other than MacOS environment: you can use
"llug"(lower for local, upper for global) as normalization type, if
you enable "hgext.debug-normfn" extension.


More information about the Mercurial-devel mailing list