comparison mercurial/scmutil.py @ 23686:164915e8ef7b

narrowmatcher: propagate the rel() method The full path is propagated to the original match object since this is often used directly for printing a file name to the user. This is cleaner than requiring each caller to join the prefix with the file name prior to calling it, and will lead to not having to pass the prefix around separately. It is also consistent with the bad() and abs() methods in terms of the required input. The uipath() method now inherits this path building property. There is no visible change in path style for rel() because it ultimately calls util.pathto(), which returns an os.sep based path. (The previous os.path.join() was violating the documented usage of util.pathto(), that its third parameter be '/' separated.) The doctest needed to be normalized to '/' separators to avoid test differences on Windows, now that a full path is returned for a short filename. The test changes are to drop globs that are no longer necessary when printing an absolute file in a subrepo, as returned from match.uipath(). Previously when os.path.join() was used to add the prefix, the absolute path to a file in a subrepo was printed with a mix of '/' and '\'. The absolute path for a file not in a subrepo, as returned from match.uipath(), is still purely '/' based.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 27 Nov 2014 10:16:56 -0500
parents 7559dc8c4238
children fafd9a1284cf
comparison
equal deleted inserted replaced
23685:5b1eac343ccd 23686:164915e8ef7b
771 toprint = unknownset.copy() 771 toprint = unknownset.copy()
772 toprint.update(deleted) 772 toprint.update(deleted)
773 for abs in sorted(toprint): 773 for abs in sorted(toprint):
774 if repo.ui.verbose or not m.exact(abs): 774 if repo.ui.verbose or not m.exact(abs):
775 if abs in unknownset: 775 if abs in unknownset:
776 status = _('adding %s\n') % m.uipath(join(abs)) 776 status = _('adding %s\n') % m.uipath(abs)
777 else: 777 else:
778 status = _('removing %s\n') % m.uipath(join(abs)) 778 status = _('removing %s\n') % m.uipath(abs)
779 repo.ui.status(status) 779 repo.ui.status(status)
780 780
781 renames = _findrenames(repo, m, added + unknown, removed + deleted, 781 renames = _findrenames(repo, m, added + unknown, removed + deleted,
782 similarity) 782 similarity)
783 783