From patchwork Wed Sep 28 00:19:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: remotefilectx: use manifest.find() to look for a single file From: via Mercurial-devel X-Patchwork-Id: 16796 Message-Id: <38faebcddb68e8425fd5.1475021944@martinvonz.mtv.corp.google.com> To: mercurial-devel@mercurial-scm.org Date: Tue, 27 Sep 2016 17:19:04 -0700 # HG changeset patch # User Martin von Zweigbergk # Date 1475020863 25200 # Tue Sep 27 17:01:03 2016 -0700 # Node ID 38faebcddb68e8425fd5fcc64b58b61002ce0eaa # Parent 69eeafa68cd0e62916dab43e1c5bcdc62069e19d remotefilectx: use manifest.find() to look for a single file The find() method on the manifest class (i.e. the revlog) is optimized for both flat and treemanifests, so use that where we're only looking for a single file. diff -r 69eeafa68cd0 -r 38faebcddb68 remotefilelog/remotefilectx.py --- a/remotefilelog/remotefilectx.py Tue Aug 30 10:18:24 2016 -0700 +++ b/remotefilelog/remotefilectx.py Tue Sep 27 17:01:03 2016 -0700 @@ -68,7 +68,7 @@ if path in data[3]: # checking the 'files' field. # The file has been touched, check if the hash is what we're # looking for. - if fileid == ma.readfast(data[0]).get(path): + if fileid == ma.find(data[0], path)[0]: return rev # Couldn't find the linkrev. This should generally not happen, and will @@ -215,7 +215,7 @@ if path in ac[3]: # checking the 'files' field. # The file has been touched, check if the content is # similar to the one we search for. - if fnode == ma.readfast(ac[0]).get(path): + if fnode == ma.find(ac[0], path)[0]: return cl.node(a) return linknode