Inheritance: VersionControlSystem
        private VersionInfo GetDirStatus(Repository repo, FilePath localPath, bool getRemoteStatus)
        {
            SubversionVersionControl vcs = (SubversionVersionControl)repo.VersionControlSystem;

            // If the directory is not versioned, there is no version info
            if (!Directory.Exists(GetDirectoryDotSvn(vcs, localPath)))
            {
                return(VersionInfo.CreateUnversioned(localPath, true));
            }

            foreach (VersionInfo ent in Status(repo, localPath, SvnRevision.Head, false, false, getRemoteStatus))
            {
                if (ent.LocalPath.CanonicalPath == localPath.CanonicalPath)
                {
                    return(ent);
                }
            }
            return(VersionInfo.CreateUnversioned(localPath, true));
        }
示例#2
0
        private VersionInfo GetFileStatus(Repository repo, FilePath sourcefile, bool getRemoteStatus)
        {
            SubversionRepository     srepo = (SubversionRepository)repo;
            SubversionVersionControl vcs   = (SubversionVersionControl)repo.VersionControlSystem;

            // If the directory is not versioned, there is no version info
            if (!Directory.Exists(GetDirectoryDotSvn(vcs, sourcefile.ParentDirectory)))
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }
            if (!sourcefile.IsChildPathOf(srepo.RootPath))
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            List <VersionInfo> statuses = new List <VersionInfo> ();

            statuses.AddRange(Status(repo, sourcefile, SvnRevision.Head, false, false, getRemoteStatus));

            if (statuses.Count == 0)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            if (statuses.Count != 1)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            VersionInfo ent = (VersionInfo)statuses[0];

            if (ent.IsDirectory)
            {
                return(VersionInfo.CreateUnversioned(sourcefile, false));
            }

            return(ent);
        }
		internal static string GetDirectoryDotSvn (SubversionVersionControl vcs, FilePath path)
		{
			return vcs.GetDirectoryDotSvn (path);
		}
 internal static string GetDirectoryDotSvn(SubversionVersionControl vcs, FilePath path)
 {
     return(vcs.GetDirectoryDotSvn(path));
 }
示例#5
0
        public override void Add(FilePath[] paths, bool recurse, IProgressMonitor monitor)
        {
            foreach (FilePath path in paths)
            {
                if (IsVersioned(path) && File.Exists(path) && !Directory.Exists(path))
                {
                    if (rootPath == null)
                    {
                        throw new UserException(GettextCatalog.GetString("Project publishing failed. There is a stale .svn folder in the path '{0}'", path.ParentDirectory));
                    }
                    VersionInfo srcInfo = GetVersionInfo(path, false);
                    if (srcInfo.HasLocalChange(VersionStatus.ScheduledDelete))
                    {
                        // It is a file that was deleted. It can be restored now since it's going
                        // to be added again.
                        // First of all, make a copy of the file
                        string tmp = Path.GetTempFileName();
                        File.Copy(path, tmp, true);

                        // Now revert the status of the file
                        Revert(path, false, monitor);

                        // Copy the file over the old one and clean up
                        File.Copy(tmp, path, true);
                        File.Delete(tmp);
                    }
                }
                else
                {
                    if (File.Exists(path) && !IsVersioned(path.ParentDirectory))
                    {
                        // The file belongs to an unversioned folder. We can add it by versioning the parent
                        // folders up to the root of the repository

                        if (!path.IsChildPathOf(rootPath))
                        {
                            throw new InvalidOperationException("File outside the repository directory");
                        }

                        List <FilePath> dirChain  = new List <FilePath> ();
                        FilePath        parentDir = path.CanonicalPath;
                        do
                        {
                            parentDir = parentDir.ParentDirectory;
                            if (Directory.Exists(SubversionVersionControl.GetDirectoryDotSvn(parentDir)))
                            {
                                break;
                            }
                            dirChain.Add(parentDir);
                        }while (parentDir != rootPath);

                        // Found all parent unversioned dirs. Versin them now.
                        dirChain.Reverse();
                        FileUpdateEventArgs args = new FileUpdateEventArgs();
                        foreach (var d in dirChain)
                        {
                            Svn.Add(d, false, monitor);
                            args.Add(new FileUpdateEventInfo(this, dirChain [0], true));
                        }
                        VersionControlService.NotifyFileStatusChanged(args);
                    }
                    Svn.Add(path, recurse, monitor);
                }
            }
        }
示例#6
0
 public SubversionRepository(SubversionVersionControl vcs, string url, FilePath rootPath) : base(vcs)
 {
     Url           = url;
     this.rootPath = !rootPath.IsNullOrEmpty ? rootPath.CanonicalPath : null;
 }
		public SubversionRepository (SubversionVersionControl vcs, string url, FilePath rootPath): base (vcs)
		{
			Url = url;
			this.rootPath = !rootPath.IsNullOrEmpty ? rootPath.CanonicalPath : null;
		}
 static bool IsVersioned(FilePath sourcefile)
 {
     return(SubversionVersionControl.IsVersioned(sourcefile));
 }
示例#9
0
		public SubversionRepository (SubversionVersionControl vcs, string url): base (vcs)
		{
			Url = url;
		}
 public SubversionRepository(SubversionVersionControl vcs, string url) : base(vcs)
 {
     Url = url;
 }
		public SubversionRepository (SubversionVersionControl vcs, string url, FilePath rootPath): base (vcs)
		{
			Url = url;
			this.rootPath = rootPath.CanonicalPath;
		}
示例#12
0
 string GetDirectoryDotSvn(string sourcepath)
 {
     return(SubversionVersionControl.GetDirectoryDotSvn(sourcepath));
 }
示例#13
0
 string GetTextBase(string sourcefile)
 {
     return(SubversionVersionControl.GetTextBase(sourcefile));
 }