##// END OF EJS Templates
config: introduce a new value for ui.relative-paths getting old behavior...
Martin von Zweigbergk -
r41716:aec185af default
parent child Browse files
Show More
@@ -5421,7 +5421,7 b' def status(ui, repo, *pats, **opts):'
5421 relative = True
5421 relative = True
5422 elif ui.hasconfig('commands', 'status.relative'):
5422 elif ui.hasconfig('commands', 'status.relative'):
5423 relative = ui.configbool('commands', 'status.relative')
5423 relative = ui.configbool('commands', 'status.relative')
5424 uipathfn = scmutil.getuipathfn(repo, relative)
5424 uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative)
5425
5425
5426 if opts.get('print0'):
5426 if opts.get('print0'):
5427 end = '\0'
5427 end = '\0'
@@ -1207,7 +1207,7 b" coreconfigitem('ui', 'quietbookmarkmove'"
1207 default=False,
1207 default=False,
1208 )
1208 )
1209 coreconfigitem('ui', 'relative-paths',
1209 coreconfigitem('ui', 'relative-paths',
1210 default=False,
1210 default='legacy',
1211 )
1211 )
1212 coreconfigitem('ui', 'remotecmd',
1212 coreconfigitem('ui', 'remotecmd',
1213 default='hg',
1213 default='hg',
@@ -725,9 +725,32 b' def meaningfulparents(repo, ctx):'
725 return []
725 return []
726 return parents
726 return parents
727
727
728 def getuipathfn(repo, relative=None):
728 def getuipathfn(repo, legacyrelativevalue=False, forcerelativevalue=None):
729 if relative is None:
729 """Return a function that produced paths for presenting to the user.
730 relative = repo.ui.configbool('ui', 'relative-paths')
730
731 The returned function takes a repo-relative path and produces a path
732 that can be presented in the UI.
733
734 Depending on the value of ui.relative-paths, either a repo-relative or
735 cwd-relative path will be produced.
736
737 legacyrelativevalue is the value to use if ui.relative-paths=legacy
738
739 If forcerelativevalue is not None, then that value will be used regardless
740 of what ui.relative-paths is set to.
741 """
742 if forcerelativevalue is not None:
743 relative = forcerelativevalue
744 else:
745 config = repo.ui.config('ui', 'relative-paths')
746 if config == 'legacy':
747 relative = legacyrelativevalue
748 else:
749 relative = stringutil.parsebool(config)
750 if relative is None:
751 raise error.ConfigError(
752 _("ui.relative-paths is not a boolean ('%s')") % config)
753
731 if relative:
754 if relative:
732 cwd = repo.getcwd()
755 cwd = repo.getcwd()
733 pathto = repo.pathto
756 pathto = repo.pathto
General Comments 0
You need to be logged in to leave comments. Login now