def find_copyfrom(self, path):
        def smart_join(p1, p2):
            if p2:
                return os.path.join(p1, p2)

            return p1

        path1 = path
        path2 = None

        while path1:
            info = self.svn_info(path1, ignore_errors=True) or {}
            url = info.get('Copied From URL', None)

            if url:
                root = info['Repository Root']
                from_path1 = unquote(url[len(root):]).encode('utf-8')
                return smart_join(from_path1, path2)

            if info.get('Schedule', None) != 'normal':
                # Not added as a part of the parent directory, bail out
                return None

            # Strip one component from path1 to path2
            path1, tmp = os.path.split(path1)

            if path1 == b'' or path1 == b'/':
                path1 = None
            else:
                path2 = smart_join(tmp, path2)

        return None
A helper function for handle_renames
dataset/ETHPy150Open reviewboard/rbtools/rbtools/clients/svn.py/SVNClient.find_copyfrom