comparison mercurial/match.py @ 41668:c4f023b656cf

match: delete unused rel() (API) Differential Revision: https://phab.mercurial-scm.org/D5923
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 09 Feb 2019 16:46:11 -0800
parents 727f0be3539a
children a13268524c25
comparison
equal deleted inserted replaced
41667:8fa1a5fb8a28 41668:c4f023b656cf
275 275
276 # If an traversedir is set, it will be called when a directory discovered 276 # If an traversedir is set, it will be called when a directory discovered
277 # by recursive traversal is visited. 277 # by recursive traversal is visited.
278 traversedir = None 278 traversedir = None
279 279
280 def rel(self, f):
281 '''Convert repo path back to path that is relative to cwd of matcher.'''
282 return util.pathto(self._root, self._cwd, f)
283
284 @propertycache 280 @propertycache
285 def _files(self): 281 def _files(self):
286 return [] 282 return []
287 283
288 def files(self): 284 def files(self):
708 # TODO: Consider encapsulating these things in a class so there's only 704 # TODO: Consider encapsulating these things in a class so there's only
709 # one thing to copy from m1. 705 # one thing to copy from m1.
710 m.bad = m1.bad 706 m.bad = m1.bad
711 m.explicitdir = m1.explicitdir 707 m.explicitdir = m1.explicitdir
712 m.traversedir = m1.traversedir 708 m.traversedir = m1.traversedir
713 m.rel = m1.rel
714 return m 709 return m
715 if m2.always(): 710 if m2.always():
716 m = copy.copy(m1) 711 m = copy.copy(m1)
717 return m 712 return m
718 return intersectionmatcher(m1, m2) 713 return intersectionmatcher(m1, m2)
796 True 791 True
797 >>> m2.files() 792 >>> m2.files()
798 ['b.txt'] 793 ['b.txt']
799 >>> m2.exact(b'b.txt') 794 >>> m2.exact(b'b.txt')
800 True 795 True
801 >>> util.pconvert(m2.rel(b'b.txt'))
802 'sub/b.txt'
803 >>> def bad(f, msg): 796 >>> def bad(f, msg):
804 ... print(pycompat.sysstr(b"%s: %s" % (f, msg))) 797 ... print(pycompat.sysstr(b"%s: %s" % (f, msg)))
805 >>> m1.bad = bad 798 >>> m1.bad = bad
806 >>> m2.bad(b'x.txt', b'No such file') 799 >>> m2.bad(b'x.txt', b'No such file')
807 sub/x.txt: No such file 800 sub/x.txt: No such file
821 if matcher.prefix(): 814 if matcher.prefix():
822 self._always = any(f == path for f in matcher._files) 815 self._always = any(f == path for f in matcher._files)
823 816
824 def bad(self, f, msg): 817 def bad(self, f, msg):
825 self._matcher.bad(self._path + "/" + f, msg) 818 self._matcher.bad(self._path + "/" + f, msg)
826
827 def rel(self, f):
828 return self._matcher.rel(self._path + "/" + f)
829 819
830 def matchfn(self, f): 820 def matchfn(self, f):
831 # Some information is lost in the superclass's constructor, so we 821 # Some information is lost in the superclass's constructor, so we
832 # can not accurately create the matching function for the subdirectory 822 # can not accurately create the matching function for the subdirectory
833 # from the inputs. Instead, we override matchfn() and visitdir() to 823 # from the inputs. Instead, we override matchfn() and visitdir() to