GetRepositoryReference() public static method

public static GetRepositoryReference ( string path, string id ) : Repository
path string
id string
return Repository
コード例 #1
0
        public static Repository GetRepository(IWorkspaceObject entry)
        {
            if (IsGloballyDisabled)
            {
                return(null);
            }

            InternalRepositoryReference repoRef = (InternalRepositoryReference)entry.ExtendedProperties [typeof(InternalRepositoryReference)];

            if (repoRef != null)
            {
                return(repoRef.Repo);
            }

            Repository repo = VersionControlService.GetRepositoryReference(entry.BaseDirectory, entry.Name);
            InternalRepositoryReference rref = null;

            if (repo != null)
            {
                repo.AddRef();
                if (!referenceCache.TryGetValue(repo, out rref))
                {
                    rref = new InternalRepositoryReference(repo);
                    referenceCache [repo] = rref;
                }
            }
            entry.ExtendedProperties [typeof(InternalRepositoryReference)] = rref;

            return(repo);
        }
コード例 #2
0
        public static Repository GetRepository(IWorkspaceObject entry)
        {
            Repository repo = (Repository)entry.ExtendedProperties [typeof(Repository)];

            if (repo != null)
            {
                return(repo);
            }

            repo = VersionControlService.GetRepositoryReference(entry.BaseDirectory, entry.Name);
            entry.ExtendedProperties [typeof(Repository)] = repo;

            return(repo);
        }
コード例 #3
0
        public static Repository GetRepository(IWorkspaceObject entry)
        {
            InternalRepositoryReference repoRef = (InternalRepositoryReference)entry.ExtendedProperties [typeof(InternalRepositoryReference)];

            if (repoRef != null)
            {
                return(repoRef.Repo);
            }

            Repository repo = VersionControlService.GetRepositoryReference(entry.BaseDirectory, entry.Name);
            InternalRepositoryReference rref = null;

            if (repo != null)
            {
                repo.AddRef();
                rref = new InternalRepositoryReference(repo);
            }
            entry.ExtendedProperties [typeof(InternalRepositoryReference)] = rref;

            return(repo);
        }