Patchwork dirstate: use repository root as base for relative paths read from ui.ignore

login
register
mail settings
Submitter Isaac Jurado
Date April 18, 2013, 7:44 p.m.
Message ID <c4a3d2a6e960ab272f53.1366314278@findus>
Download mbox | patch
Permalink /patch/1434/
State Rejected
Headers show

Comments

Isaac Jurado - April 18, 2013, 7:44 p.m.
# HG changeset patch
# User Isaac Jurado <diptongo@gmail.com>
# Date 1366314160 -7200
#      Thu Apr 18 21:42:40 2013 +0200
# Node ID c4a3d2a6e960ab272f53add8d894e5fe8deb194a
# Parent  7d31f2e42a8afb54c8fae87e8e3e29a63578aea4
dirstate: use repository root as base for relative paths read from ui.ignore

Convert relative paths from the ui.ignore* configurations to absolute by
prepending the path to the repository root.  This breaks the old, and probably
unused, behaviour where relative paths were interpreted from the working
directory.

Absolute paths are kept untouched.
Files containing additional ignore rules are added with the ignore configuration
option
Isaac Jurado - April 18, 2013, 7:56 p.m.
Replying diptongo@gmail.com:
> # HG changeset patch
> # User Isaac Jurado <diptongo@gmail.com>
> # Date 1366314160 -7200
> #      Thu Apr 18 21:42:40 2013 +0200
> # Node ID c4a3d2a6e960ab272f53add8d894e5fe8deb194a
> # Parent  7d31f2e42a8afb54c8fae87e8e3e29a63578aea4
> dirstate: use repository root as base for relative paths read from ui.ignore
> 
> Convert relative paths from the ui.ignore* configurations to absolute by
> prepending the path to the repository root.  This breaks the old, and probably
> unused, behaviour where relative paths were interpreted from the working
> directory.
> 
> Absolute paths are kept untouched.
> Files containing additional ignore rules are added with the ignore configuration
> option

Oops, I messed the commit message.  I'll resend.

> 
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -103,7 +103,11 @@
>          files = [self._join('.hgignore')]
>          for name, path in self._ui.configitems("ui"):
>              if name == 'ignore' or name.startswith('ignore.'):
> -                files.append(util.expandpath(path))
> +                p = util.expandpath(path)
> +                if os.path.isabs(p):
> +                    files.append(p)
> +                else:
> +                    files.append(self._join(p))
>          return ignore.ignore(self._root, files, self._ui.warn)
>  
>      @propertycache

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -103,7 +103,11 @@ 
         files = [self._join('.hgignore')]
         for name, path in self._ui.configitems("ui"):
             if name == 'ignore' or name.startswith('ignore.'):
-                files.append(util.expandpath(path))
+                p = util.expandpath(path)
+                if os.path.isabs(p):
+                    files.append(p)
+                else:
+                    files.append(self._join(p))
         return ignore.ignore(self._root, files, self._ui.warn)
 
     @propertycache