Patchwork [1,of,2,stable] match: fix root calculation for combining regexps with simple paths

login
register
mail settings
Submitter Mads Kiilerich
Date April 29, 2013, 11:12 p.m.
Message ID <1a03a17839751dbc4eb4.1367277166@mk-desktop>
Download mbox | patch
Permalink /patch/1505/
State Accepted
Commit fcf08023c0113a98bb61652cc8e60627390e166a
Headers show

Comments

Mads Kiilerich - April 29, 2013, 11:12 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1367276675 -7200
#      Tue Apr 30 01:04:35 2013 +0200
# Branch stable
# Node ID 1a03a17839751dbc4eb4f6fccbdd0c8f1e5c7379
# Parent  f01a351db79106ba96ac6d527cf69944fd98e665
match: fix root calculation for combining regexps with simple paths

The fall-back root for walking is the repo root, not no root.

The "roots" do however also end up in m.files() which is used in various ways,
for instance to indicate whether matches are exact. The change could thus have
other impacts.
Matt Mackall - May 1, 2013, 7:26 p.m.
On Tue, 2013-04-30 at 01:12 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1367276675 -7200
> #      Tue Apr 30 01:04:35 2013 +0200
> # Branch stable
> # Node ID 1a03a17839751dbc4eb4f6fccbdd0c8f1e5c7379
> # Parent  f01a351db79106ba96ac6d527cf69944fd98e665
> match: fix root calculation for combining regexps with simple paths

This is queued for stable, thanks.

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -344,7 +344,7 @@ 
             r.append('/'.join(root) or '.')
         elif kind in ('relpath', 'path'):
             r.append(name or '.')
-        elif kind == 'relglob':
+        else: # relglob, re, relre
             r.append('.')
     return r
 
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -100,6 +100,13 @@ 
   ? ../1/in_b_1
   ? in_b_2
   ? ../in_b
+
+combining patterns with root and patterns without a root works
+
+  $ hg st a/in_a re:.*b$
+  ? a/in_a
+  ? b/in_b
+
   $ cd ..
 
   $ hg init repo2