code: def _fix_path(self, path):
          
          if path.endswith('/'):
              path = path.rstrip('/')
  
          return safe_str(path)
docs: Paths are stored without trailing slash so we need to get rid off it if
          needed. Also mercurial keeps filenodes as str so we need to decode
          from unicode to str