public static Repository GetRepository(WorkspaceObject entry)
        {
            if (IsGloballyDisabled)
            {
                return(null);
            }

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

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

            Repository repo = 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);
        }
Exemple #2
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();
                if (!referenceCache.TryGetValue(repo, out rref))
                {
                    rref = new InternalRepositoryReference(repo);
                    referenceCache [repo] = rref;
                }
            }
            entry.ExtendedProperties [typeof(InternalRepositoryReference)] = rref;

            return(repo);
        }
		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;
		}
		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;
		}