diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -139,13 +139,8 @@ def explain_exit(code): return _("stopped by signal %d") % val, val raise ValueError(_("invalid exit code")) -def isowner(fp, st=None): - """Return True if the file object f belongs to the current user. - - The return value of a util.fstat(f) may be passed as the st argument. - """ - if st is None: - st = fstat(fp) +def isowner(st): + """Return True if the stat object st is from the current user.""" return st.st_uid == os.getuid() def find_exe(command): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -40,7 +40,7 @@ class ui(object): def _is_trusted(self, fp, f): st = util.fstat(fp) - if util.isowner(fp, st): + if util.isowner(st): return True tusers, tgroups = self._trustusers, self._trustgroups diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -164,7 +164,7 @@ def explain_exit(code): # if you change this stub into a real check, please try to implement the # username and groupname functions above, too. -def isowner(fp, st=None): +def isowner(st): return True def find_exe(command): diff --git a/tests/test-trusted.py b/tests/test-trusted.py --- a/tests/test-trusted.py +++ b/tests/test-trusted.py @@ -44,7 +44,7 @@ def testui(user='foo', group='bar', tuse return group util.groupname = groupname - def isowner(fp, st=None): + def isowner(st): return user == cuser util.isowner = isowner