This is an archive of the discontinued Mercurial Phabricator instance.

context: remove seemingly impossible code branch
ClosedPublic

Authored by martinvonz on Nov 20 2018, 2:08 AM.

Details

Summary

I'm not a Python expert, but I can't think of a way that the following
branch can ever be hit:

    def _changeid(self):
        if r'_changeid' in self.__dict__:
	    return self._changeid

It seems to me that if that condition is true, then this function
would not have been called. The only exception I can think of is if a
reference to the function had been stored beforehand, something like this:

c = fctx.dict['_changeid']
fctx._changeid
c()

But that seems like very unlikely code to exist.

The condition was added in 921b64e1f7b9 (filecontext: use 'is not
None' to check for filelog existence, 2013-05-01) as a "bonus" change
(in addition to what the patch was actually about)

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Nov 20 2018, 2:08 AM
This revision was automatically updated to reflect the committed changes.