mercurial/logcmdutil.py
changeset 41647 ec37db02fc72
parent 41646 d4c9eebdd72d
child 41655 df59b1078983
equal deleted inserted replaced
41646:d4c9eebdd72d 41647:ec37db02fc72
    64     if root:
    64     if root:
    65         relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
    65         relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
    66     else:
    66     else:
    67         relroot = ''
    67         relroot = ''
    68     copysourcematch = None
    68     copysourcematch = None
       
    69     def compose(f, g):
       
    70         return lambda x: f(g(x))
    69     def pathfn(f):
    71     def pathfn(f):
    70         return posixpath.join(prefix, f)
    72         return posixpath.join(prefix, f)
    71     if relroot != '':
    73     if relroot != '':
    72         # XXX relative roots currently don't work if the root is within a
    74         # XXX relative roots currently don't work if the root is within a
    73         # subrepo
    75         # subrepo
    82         match = matchmod.intersectmatchers(match, relrootmatch)
    84         match = matchmod.intersectmatchers(match, relrootmatch)
    83         copysourcematch = relrootmatch
    85         copysourcematch = relrootmatch
    84 
    86 
    85         checkroot = (repo.ui.configbool('devel', 'all-warnings') or
    87         checkroot = (repo.ui.configbool('devel', 'all-warnings') or
    86                      repo.ui.configbool('devel', 'check-relroot'))
    88                      repo.ui.configbool('devel', 'check-relroot'))
    87         def pathfn(f):
    89         def relrootpathfn(f):
    88             if checkroot and not f.startswith(relroot):
    90             if checkroot and not f.startswith(relroot):
    89                 raise AssertionError(
    91                 raise AssertionError(
    90                     "file %s doesn't start with relroot %s" % (f, relroot))
    92                     "file %s doesn't start with relroot %s" % (f, relroot))
    91             return posixpath.join(prefix, f[len(relroot):])
    93             return f[len(relroot):]
       
    94         pathfn = compose(relrootpathfn, pathfn)
    92 
    95 
    93     if stat:
    96     if stat:
    94         diffopts = diffopts.copy(context=0, noprefix=False)
    97         diffopts = diffopts.copy(context=0, noprefix=False)
    95         width = 80
    98         width = 80
    96         if not ui.plain():
    99         if not ui.plain():