[PATCH 3 of 3] Resolve issues 1083 and 912 (case collisions between different revisions)

Adrian Buehlmann adrian at cadifra.com
Wed Apr 23 04:58:42 CDT 2008


On 23.04.2008 00:10, Paul Moore wrote:
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -679,11 +679,25 @@
>          self._wlockref = weakref.ref(l)
>          return l
>  
> +    def check_case(self, fn):
> +        """Raise IOError if fn doesn't exist with this exact case"""
> +
> +        # Check that the file exists in a case sensitive manner - it may be
> +        # stored in the filesystem in a different case than the name passed in
> +        # (on case insensitive filesystems). To do this, we first check if the
> +        # file exists using os.path.exists. If it does, we double check by
> +        # ensuring that the case stored in teh filesystem matches the case
                                              ^^^ the
> +        # supplied in nfn.
                         ^^^ typo?

In general, I don't like having that much comment. At least, the second sentence simply
repeats in prose what you can already read from the code -> unneeded.

> +        full_fn = self.wjoin(fn)
> +        if not os.path.exists(full_fn) or util.filesystem_case(fn, self.root) != fn:
> +            raise IOError(errno.ENOENT, fn)
> +
>      def filecommit(self, fn, manifest1, manifest2, linkrev, tr, changelist):
>          """
>          commit an individual file as part of a larger transaction
>          """
>  
> +        self.check_case(fn)
>          t = self.wread(fn)
>          fl = self.file(fn)
>          fp1 = manifest1.get(fn, nullid)


More information about the Mercurial-devel mailing list