[PATCH] patch: remove unused fsbackend._join()

Jun Wu quark at fb.com
Fri Jun 30 11:54:20 EDT 2017


Looks good to me. I wonder if we can have some test-check automation to
detect dead code. A quick google shows "vulture" is a tool and it seems
working:

    % vulture patch.py                                                                                 ~/hg-committed/mercurial
    patch.py:148: Unused function 'next'
    patch.py:189: Unused function 'extract'
    patch.py:456: Unused function '_join'
    patch.py:993: Unused function 'filterpatch'
    patch.py:1467: Unused function 'reversehunks'
    patch.py:2109: Unused function 'patchrepo'
    patch.py:2114: Unused function 'patch'
    patch.py:2136: Unused function 'changedfiles'
    patch.py:2448: Unused function 'diffui'
    patch.py:2729: Unused function 'diffstatui'

I'll send patches to integrate it.

Excerpts from Martin von Zweigbergk's message of 2017-06-30 08:47:59 -0700:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1498802687 25200
> #      Thu Jun 29 23:04:47 2017 -0700
> # Node ID dd379552c909738a96fae181e8a6f132034f2b60
> # Parent  40ee74bfa11122a0a3ab74186f5056243b84af89
> patch: remove unused fsbackend._join()
> 
> The function lost its last caller in 2a095d3442e0 (patch: replace
> functions in fsbackend to use vfs, 2014-06-05) when the callers
> started relying on the opener to do the join.
> 
> diff --git a/mercurial/patch.py b/mercurial/patch.py
> --- a/mercurial/patch.py
> +++ b/mercurial/patch.py
> @@ -453,9 +453,6 @@
>          super(fsbackend, self).__init__(ui)
>          self.opener = vfsmod.vfs(basedir)
>  
> -    def _join(self, f):
> -        return os.path.join(self.opener.base, f)
> -
>      def getfile(self, fname):
>          if self.opener.islink(fname):
>              return (self.opener.readlink(fname), (True, False))


More information about the Mercurial-devel mailing list