Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 41491:e6ec0737b706
status: extract helper for producing relative or absolute path for UI
I put the helper in scmutil so it can be used by most modules. I would
have put it in utils.pathutil, but I think that's supposed to be
unaware of repos.
Differential Revision: https://phab.mercurial-scm.org/D5745
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 29 Jan 2019 15:37:14 -0800 |
parents | f83b230b7fb3 |
children | 02186c6871ac |
comparison
equal
deleted
inserted
replaced
41490:09f1c17e24dd | 41491:e6ec0737b706 |
---|---|
723 return [parents[0], repo[nullrev]] | 723 return [parents[0], repo[nullrev]] |
724 if parents[0].rev() >= intrev(ctx) - 1: | 724 if parents[0].rev() >= intrev(ctx) - 1: |
725 return [] | 725 return [] |
726 return parents | 726 return parents |
727 | 727 |
728 def getuipathfn(repo, relative): | |
729 if relative: | |
730 cwd = repo.getcwd() | |
731 pathto = repo.pathto | |
732 return lambda f: pathto(f, cwd) | |
733 else: | |
734 return lambda f: f | |
735 | |
728 def expandpats(pats): | 736 def expandpats(pats): |
729 '''Expand bare globs when running on windows. | 737 '''Expand bare globs when running on windows. |
730 On posix we assume it already has already been done by sh.''' | 738 On posix we assume it already has already been done by sh.''' |
731 if not util.expandglobs: | 739 if not util.expandglobs: |
732 return list(pats) | 740 return list(pats) |