fastannotate: improve compatibility with older hg

Summary:
Before ba91edc29ce5, `diffopts` does not have `__dict__`. Let's fix that by
querying keys from `diffopts.default`, instead of using `__dict__`.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4086921

Signature: t1:4086921:1477554146:e48647c59769c2951518b091350289aa966aab7b
This commit is contained in:
Jun Wu 2016-10-27 00:19:05 +01:00
parent 3339323a30
commit 79b9423cee

View File

@ -132,7 +132,10 @@ def encodedir(path):
.replace('.lock/', '.lock.hg/'))
def hashdiffopts(diffopts):
diffoptstr = str(sorted(diffopts.__dict__.iteritems()))
diffoptstr = str(sorted(
(k, getattr(diffopts, k))
for k in mdiff.diffopts.defaults.iterkeys()
))
return hashlib.sha1(diffoptstr).hexdigest()[:6]
_defaultdiffopthash = hashdiffopts(mdiff.defaultopts)