Patchwork match: add __repr__ for subdirmatcher

login
register
mail settings
Submitter via Mercurial-devel
Date May 30, 2017, 6:47 a.m.
Message ID <bd7f40b29d2eb2dcf7fc.1496126861@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21056/
State Accepted
Headers show

Comments

via Mercurial-devel - May 30, 2017, 6:47 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495829310 25200
#      Fri May 26 13:08:30 2017 -0700
# Node ID bd7f40b29d2eb2dcf7fc774096fe96310446f788
# Parent  cf7c88986e9f64926bdf79b04e2777d730cf8cb0
match: add __repr__ for subdirmatcher

Should at least be useful for debugging. Would matter for correctness
too if fsmonitor or Facebook's sparse extension worked with subrepos
(which I don't know if they do).
Yuya Nishihara - May 30, 2017, 3:41 p.m.
On Mon, 29 May 2017 23:47:41 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1495829310 25200
> #      Fri May 26 13:08:30 2017 -0700
> # Node ID bd7f40b29d2eb2dcf7fc774096fe96310446f788
> # Parent  cf7c88986e9f64926bdf79b04e2777d730cf8cb0
> match: add __repr__ for subdirmatcher

Queued, thanks.

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -629,6 +629,10 @@ 
     def anypats(self):
         return self._matcher.anypats()
 
+    def __repr__(self):
+        return ('<subdirmatcher path=%r, matcher=%r>' %
+                (self._path, self._matcher))
+
 def patkind(pattern, default=None):
     '''If pattern is 'kind:pat' with a known kind, return kind.'''
     return _patsplit(pattern, default)[0]