def cwd_to_view_name(): """Glean the view name from the current working directory's path: it's the 'foo' in 'foo/.git/'. If the Git Fusion RC file is present, then the view name will be read from the file. """ config = p4gf_rc.read_config() view_name = p4gf_rc.get_view(config) if view_name is None: # Fall back to using directory name as view name. path = p4gf_path.cwd_to_dot_git() (path, _git) = os.path.split(path) (path, view_name) = os.path.split(path) return view_name
def rc_path_to_view_name(rc_path): """Read the rc file at rc_path and return the view name stored within the rc file.""" config = p4gf_rc.read_config(rc_path=rc_path) return p4gf_rc.get_view(config)