Exemplo n.º 1
0
        public void Resolve(FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
        {
            Svn.Resolve(localPaths, recurse, monitor);
            FileUpdateEventArgs args = new FileUpdateEventArgs();

            foreach (var path in localPaths)
            {
                args.Add(new FileUpdateEventInfo(this, path, Directory.Exists(path)));
            }
            VersionControlService.NotifyFileStatusChanged(args);
        }
Exemplo n.º 2
0
            protected override void Finished()
            {
                dlg.EndCommit(success);
                dlg.Destroy();
                FileUpdateEventArgs args = new FileUpdateEventArgs();

                foreach (ChangeSetItem it in changeSet.Items)
                {
                    args.Add(new FileUpdateEventInfo(vc, it.LocalPath, it.IsDirectory));
                }

                if (args.Count > 0)
                {
                    VersionControlService.NotifyFileStatusChanged(args);
                }

                VersionControlService.NotifyAfterCommit(vc, changeSet, success);
            }
Exemplo n.º 3
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);
                }
            }
        }
Exemplo n.º 4
0
		protected override void OnAdd (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
		{
			foreach (FilePath path in localPaths) {
				if (IsVersioned (path) && File.Exists (path) && !Directory.Exists (path)) {
					if (RootPath.IsNull)
						throw new UserException (GettextCatalog.GetString ("Project publishing failed. There is a stale .svn folder in the path '{0}'", path.ParentDirectory));
					VersionInfo srcInfo = GetVersionInfo (path, VersionInfoQueryFlags.IgnoreCache);
					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);
						continue;
					}
				}
				else {
					if (!IsVersioned (path.ParentDirectory)) {
						// The file/folder 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 (IsVersioned (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, d, true));
						}
						VersionControlService.NotifyFileStatusChanged (args);
					}
				}
				Svn.Add (path, recurse, monitor);
			}
		}
Exemplo n.º 5
0
        protected override async Task OnAddAsync(FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
        {
            foreach (FilePath path in localPaths)
            {
                if (await IsVersionedAsync(path, monitor.CancellationToken).ConfigureAwait(false) && File.Exists(path) && !Directory.Exists(path))
                {
                    if (RootPath.IsNull)
                    {
                        throw new UserException(GettextCatalog.GetString("Project publishing failed. There is a stale .svn folder in the path '{0}'", path.ParentDirectory));
                    }
                    VersionInfo srcInfo = await GetVersionInfoAsync(path, VersionInfoQueryFlags.IgnoreCache).ConfigureAwait(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
                        await RevertAsync(path, false, monitor).ConfigureAwait(false);

                        // Copy the file over the old one and clean up
                        File.Copy(tmp, path, true);
                        File.Delete(tmp);
                        continue;
                    }
                }
                else
                {
                    if (!await IsVersionedAsync(path.ParentDirectory, monitor.CancellationToken).ConfigureAwait(false))
                    {
                        // The file/folder 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 (await IsVersionedAsync(parentDir, monitor.CancellationToken).ConfigureAwait(false))
                            {
                                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, d, true));
                        }
                        VersionControlService.NotifyFileStatusChanged(args);
                    }
                }
                Svn.Add(path, recurse, monitor);
            }
        }
Exemplo n.º 6
0
		public void Resolve (FilePath[] localPaths, bool recurse, IProgressMonitor monitor)
		{
			Svn.Resolve (localPaths, recurse, monitor);
			FileUpdateEventArgs args = new FileUpdateEventArgs ();
			foreach (var path in localPaths)
				args.Add (new FileUpdateEventInfo (this, path, Directory.Exists (path)));
			VersionControlService.NotifyFileStatusChanged (args);
		}