comparison mercurial/changegroup.py @ 42341:27d6956d386b

match: use '' instead of '.' for root directory (API) I think '' is generally a better value for the root directory than '.' is. For example, os.path.join('', 'foo') => 'foo', while os.path.join('.', 'foo') => './foo'. This patch mostly makes it so we use '' internally in match.py. However, it also affects the API in visitdir(), visitchildrenset() and files(). The two former now also accept '' as input. I've updated the callers of these methods. I've also added a deprecation warning for passing '.' (for external callers). The only caller I could find that was affected by files() returning '' instead of '.' was in dirstate.walk(). I've updated that. The next few patches show some workarounds we can remove by using '' instead of '.'. Differential Revision: https://phab.mercurial-scm.org/D6401
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 15 May 2017 00:12:19 -0700
parents 1c1c4ef8b72e
children 268662aac075
comparison
equal deleted inserted replaced
42340:7ada598941d2 42341:27d6956d386b
1059 return lookupmflinknode 1059 return lookupmflinknode
1060 1060
1061 while tmfnodes: 1061 while tmfnodes:
1062 tree, nodes = tmfnodes.popitem() 1062 tree, nodes = tmfnodes.popitem()
1063 1063
1064 should_visit = self._matcher.visitdir(tree[:-1] or '.') 1064 should_visit = self._matcher.visitdir(tree[:-1])
1065 if tree and not should_visit: 1065 if tree and not should_visit:
1066 continue 1066 continue
1067 1067
1068 store = mfl.getstorage(tree) 1068 store = mfl.getstorage(tree)
1069 1069
1091 topic=_('manifests'), 1091 topic=_('manifests'),
1092 clrevtolocalrev=clrevtolocalrev, 1092 clrevtolocalrev=clrevtolocalrev,
1093 fullclnodes=self._fullclnodes, 1093 fullclnodes=self._fullclnodes,
1094 precomputedellipsis=self._precomputedellipsis) 1094 precomputedellipsis=self._precomputedellipsis)
1095 1095
1096 if not self._oldmatcher.visitdir(store.tree[:-1] or '.'): 1096 if not self._oldmatcher.visitdir(store.tree[:-1]):
1097 yield tree, deltas 1097 yield tree, deltas
1098 else: 1098 else:
1099 # 'deltas' is a generator and we need to consume it even if 1099 # 'deltas' is a generator and we need to consume it even if
1100 # we are not going to send it because a side-effect is that 1100 # we are not going to send it because a side-effect is that
1101 # it updates tmdnodes (via lookupfn) 1101 # it updates tmdnodes (via lookupfn)