[PATCH 2 of 2] localrepo: check for case collisions at commit time (issue4665) (BC)

Yuya Nishihara yuya at tcha.org
Sun Aug 21 10:41:49 EDT 2016


On Wed, 17 Aug 2016 22:28:50 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1471497059 25200
> #      Wed Aug 17 22:10:59 2016 -0700
> # Node ID e8d4db665bf172344d2354c17a0eb8f69ef265c7
> # Parent  04ba5f1f6c28674ed2df750a8acca02021b2698c
> localrepo: check for case collisions at commit time (issue4665) (BC)

> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1581,16 +1581,24 @@ class localrepository(object):
>                      '.hgsubstate' not in (status.modified + status.added +
>                                            status.removed)):
>                      status.removed.insert(0, '.hgsubstate')
>  
>              # make sure all explicit patterns are matched
>              if not force:
>                  self.checkcommitpatterns(wctx, vdirs, match, status, fail)
>  
> +            # Audit added files for case collisions.
> +            caseabort, casewarn = scmutil.checkportabilityalert(self.ui)
> +            if caseabort or casewarn:
> +                cca = scmutil.ctxcasecollisionauditor(self.ui, wctx.p1(),
> +                                                      caseabort)

Maybe it wouldn't detect case collisions at merge commit.

> +                for f in status.added:
> +                    cca(f)

I think status.added isn't good enough to detect case collision at commit time.
For example, case-changing rename shouldn't be warned nor aborted.

  $ hg mv a A
  $ hg ci


More information about the Mercurial-devel mailing list