Ejemplo n.º 1
0
        internal void DoCreateDirectory()
        {
            RepositoryTreeNode tn = SelectedNode;

            if (tn == null)
            {
                return;
            }

            Uri u = tn.RawUri;

            using (Ankh.UI.SccManagement.CreateDirectoryDialog dialog = new Ankh.UI.SccManagement.CreateDirectoryDialog())
            {
                if (dialog.ShowDialog(Context) != DialogResult.OK)
                {
                    return;
                }

                Uri newDir = SvnTools.AppendPathSuffix(u, dialog.NewDirectoryName);

                Context.GetService <IProgressRunner>().RunModal(
                    RepositoryStrings.CreatingDirectory,
                    delegate(object sender, ProgressWorkerArgs a)
                {
                    SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs();
                    args.CreateParents          = true;

                    args.LogMessage = dialog.LogMessage;
                    a.Client.RemoteCreateDirectory(newDir, args);
                });

                AddRoot(newDir);
            }
        }
Ejemplo n.º 2
0
        public override void Mkdir(string[] paths, string message, IProgressMonitor monitor)
        {
            var args = new SvnCreateDirectoryArgs {
                CreateParents = true,
                LogMessage    = message,
            };

            BindMonitor(monitor);
            var uris = paths.Select(p => new Uri(p)).ToArray();

            lock (client)
                client.RemoteCreateDirectories(uris, args);
        }
Ejemplo n.º 3
0
        internal bool CreateComponents(List <string> componentNameList)
        {
            try
            {
                using (SvnClient client = new SvnClient())
                {
                    // Bind the SharpSvn UI to our client for SSL certificate and credentials
                    SvnUIBindArgs bindArgs = new SvnUIBindArgs();
                    SvnUI.Bind(client, bindArgs);

                    List <Uri> folderList = new List <Uri>();

                    if (componentNameList.Count > 0)
                    {
                        foreach (string componentName in componentNameList)
                        {
                            SvnUriTarget componentUrl = new SvnUriTarget(this.componentsUri + "/" + componentName);

                            if (this.CheckUrlValide(client, componentUrl) == false)
                            {
                                folderList.AddRange(new Uri[]
                                {
                                    componentUrl.Uri,
                                    new Uri(string.Format("{0}/branches/", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/archive", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/core", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/core/ifsapp-8.0", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/core/ifsapp-8.0/main", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/core/ifsapp-9.0", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/core/ifsapp-9.0/main", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/branches/project", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/tags/", componentUrl.ToString())),
                                    new Uri(string.Format("{0}/trunk/", componentUrl.ToString()))
                                });
                            }
                        }

                        SvnCreateDirectoryArgs arg = new SvnCreateDirectoryArgs();
                        arg.CreateParents = true;
                        arg.LogMessage    = "ADMIN-0: Component structure created.";

                        return(client.RemoteCreateDirectories(folderList, arg));
                    }
                }
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public override void Mkdir(string[] paths, string message, IProgressMonitor monitor)
        {
            SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs();

            args.CreateParents = true;
            BindMonitor(args, monitor);
            List <Uri> uris = new List <Uri> ();

            foreach (string path in paths)
            {
                uris.Add(new Uri(path));
            }
            args.LogMessage = message;
            client.RemoteCreateDirectories(uris, args);
        }
Ejemplo n.º 5
0
        public override void Mkdir(string[] paths, string message, IProgressMonitor monitor)
        {
            var args = new SvnCreateDirectoryArgs {
                CreateParents = true,
                LogMessage    = message,
            };

            BindMonitor(monitor);
            var uris = new List <Uri> ();

            foreach (string path in paths)
            {
                uris.Add(new Uri(path));
            }
            lock (client)
                client.RemoteCreateDirectories(uris, args);
        }
Ejemplo n.º 6
0
        internal bool CreateProject(string projectName)
        {
            try
            {
                using (SvnClient client = new SvnClient())
                {
                    // Bind the SharpSvn UI to our client for SSL certificate and credentials
                    SvnUIBindArgs bindArgs = new SvnUIBindArgs();
                    SvnUI.Bind(client, bindArgs);

                    List <Uri> folderList = new List <Uri>();

                    if (string.IsNullOrWhiteSpace(projectName) == false)
                    {
                        SvnUriTarget projectUrl = new SvnUriTarget(this.projectsUri + "/" + projectName);

                        if (this.CheckUrlValide(client, projectUrl) == false)
                        {
                            folderList.AddRange(new Uri[]
                            {
                                projectUrl.Uri,
                                new Uri(string.Format("{0}/documentation/", projectUrl.ToString())),
                                new Uri(string.Format("{0}/nbproject/", projectUrl.ToString())),
                                new Uri(string.Format("{0}/release/", projectUrl.ToString())),
                                new Uri(string.Format("{0}/tags/", projectUrl.ToString())),
                                new Uri(string.Format("{0}/workspace/", projectUrl.ToString()))
                            });
                        }

                        SvnCreateDirectoryArgs arg = new SvnCreateDirectoryArgs();
                        arg.CreateParents = true;
                        arg.LogMessage    = "ADMIN-0: Component structure created.";

                        return(client.RemoteCreateDirectories(folderList, arg));
                    }
                }
                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
0
        public override void OnExecute(CommandEventArgs e)
        {
            ISvnRepositoryItem selected = EnumTools.GetSingle(e.Selection.GetSelection <ISvnRepositoryItem>());

            string directoryName = "";

            using (CreateDirectoryDialog dlg = new CreateDirectoryDialog())
            {
                DialogResult result = dlg.ShowDialog(e.Context);

                directoryName = dlg.NewDirectoryName;

                if (result != DialogResult.OK || string.IsNullOrEmpty(directoryName))
                {
                    return;
                }

                string log = dlg.LogMessage;

                // Handle special characters like on local path
                Uri uri = SvnTools.AppendPathSuffix(selected.Uri, directoryName);

                ProgressRunnerResult prResult =
                    e.GetService <IProgressRunner>().RunModal(
                        CommandStrings.CreatingDirectories,
                        delegate(object sender, ProgressWorkerArgs ee)
                {
                    SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs();
                    args.ThrowOnError           = false;
                    args.CreateParents          = true;
                    args.LogMessage             = log;
                    ee.Client.RemoteCreateDirectory(uri, args);
                }
                        );

                if (prResult.Succeeded)
                {
                    selected.RefreshItem(false);
                }
            }
        }
Ejemplo n.º 8
0
        public void ChangedDirs()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri        uri  = sbox.CreateRepository(SandBoxRepository.Empty);

            using (InstallHook(uri, SvnHookType.PreCommit, OnChangedDirs))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCreateDirectoryArgs da = new SvnCreateDirectoryArgs();
                    da.CreateParents = true;
                    da.LogMessage    = "Created!";
                    cl.RemoteCreateDirectories(
                        new Uri[]
                    {
                        new Uri(uri, "a/b/c/d/e/f"),
                        new Uri(uri, "a/b/c/d/g/h"),
                        new Uri(uri, "i/j/k"),
                        new Uri(uri, "l/m/n"),
                        new Uri(uri, "l/m/n/o/p")
                    }, da);
                }
            }

            using (InstallHook(uri, SvnHookType.PreCommit, OnCopyDir))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCopyArgs ca = new SvnCopyArgs();
                    ca.CreateParents = true;
                    ca.LogMessage    = "Created!";
                    cl.RemoteCopy(
                        new SvnUriTarget[]
                    {
                        new Uri(uri, "a/b/c/d"),
                        new Uri(uri, "i/j")
                    }, uri, ca);
                }
            }
        }
Ejemplo n.º 9
0
        public void ChangedDirs()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri uri = sbox.CreateRepository(SandBoxRepository.Empty);
            using (InstallHook(uri, SvnHookType.PreCommit, OnChangedDirs))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCreateDirectoryArgs da = new SvnCreateDirectoryArgs();
                    da.CreateParents = true;
                    da.LogMessage = "Created!";
                    cl.RemoteCreateDirectories(
                    new Uri[]
                        {
                        new Uri(uri, "a/b/c/d/e/f"),
                        new Uri(uri, "a/b/c/d/g/h"),
                        new Uri(uri, "i/j/k"),
                        new Uri(uri, "l/m/n"),
                        new Uri(uri, "l/m/n/o/p")
                        }, da);
                }
            }

            using (InstallHook(uri, SvnHookType.PreCommit, OnCopyDir))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCopyArgs ca = new SvnCopyArgs();
                    ca.CreateParents = true;
                    ca.LogMessage = "Created!";
                    cl.RemoteCopy(
                    new SvnUriTarget[]
                        {
                        new Uri(uri, "a/b/c/d"),
                        new Uri(uri, "i/j")
                        }, uri, ca);
                }
            }
        }
Ejemplo n.º 10
0
        public override void OnExecute(CommandEventArgs e)
        {
            ISvnRepositoryItem selected = EnumTools.GetSingle(e.Selection.GetSelection<ISvnRepositoryItem>());

            string directoryName = "";

            using (CreateDirectoryDialog dlg = new CreateDirectoryDialog())
            {
                DialogResult result = dlg.ShowDialog(e.Context);

                directoryName = dlg.NewDirectoryName;

                if (result != DialogResult.OK || string.IsNullOrEmpty(directoryName))
                    return;

                string log = dlg.LogMessage;

                // Handle special characters like on local path
                Uri uri = SvnTools.AppendPathSuffix(selected.Uri, directoryName);

                ProgressRunnerResult prResult =
                    e.GetService<IProgressRunner>().RunModal(
                    CommandStrings.CreatingDirectories,
                    delegate(object sender, ProgressWorkerArgs ee)
                    {
                        SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs();
                        args.ThrowOnError = false;
                        args.CreateParents = true;
                        args.LogMessage = log;
                        ee.Client.RemoteCreateDirectory(uri, args);
                    }
                    );

                if (prResult.Succeeded)
                {
                    selected.RefreshItem(false);
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates the directory specified by <see cref="uri"/>
        /// Returns false if the user cancelled creating the directory, true otherwise
        /// </summary>
        /// <param name="e"></param>
        /// <param name="title">The title of the Create dialog</param>
        /// <param name="uri">The directory to be created</param>
        /// <param name="cl"></param>
        /// <returns></returns>
        static bool RemoteCreateDirectory(CommandEventArgs e, string title, Uri uri, SvnClient cl)
        {
            using (CreateDirectoryDialog createDialog = new CreateDirectoryDialog())
            {
                createDialog.Text = title; // Override dialog title with text from other dialog

                createDialog.NewDirectoryName     = uri.ToString();
                createDialog.NewDirectoryReadonly = true;
                if (createDialog.ShowDialog(e.Context) == DialogResult.OK)
                {
                    // Create uri (including optional /trunk if required)
                    SvnCreateDirectoryArgs cdArg = new SvnCreateDirectoryArgs();
                    cdArg.CreateParents = true;
                    cdArg.LogMessage    = createDialog.LogMessage;

                    cl.RemoteCreateDirectory(uri, cdArg);
                    return(true);
                }

                return(false); // bail out, we cannot continue without directory in the repository
            }
        }
Ejemplo n.º 12
0
        public void PostCommitErrorTest()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri        uri  = sbox.CreateRepository(SandBoxRepository.Empty);

            using (InstallHook(uri, SvnHookType.PostCommit, OnPostCommit))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCommitResult        cr;
                    SvnCreateDirectoryArgs da = new SvnCreateDirectoryArgs();
                    da.CreateParents = true;
                    da.LogMessage    = "Created!";
                    cl.RemoteCreateDirectory(new Uri(uri, "a/b/c/d/e/f"), da, out cr);

                    Assert.That(cr, Is.Not.Null);
                    Assert.That(cr.PostCommitError.Contains(Environment.NewLine));
                    Assert.That(cr.PostCommitError.Substring(
                                    cr.PostCommitError.IndexOf(Environment.NewLine, StringComparison.OrdinalIgnoreCase)
                                    + Environment.NewLine.Length),
                                Is.EqualTo("The Post Commit Warning"));
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates the directory specified by <see cref="uri"/>
        /// Returns false if the user cancelled creating the directory, true otherwise
        /// </summary>
        /// <param name="e"></param>
        /// <param name="title">The title of the Create dialog</param>
        /// <param name="uri">The directory to be created</param>
        /// <param name="cl"></param>
        /// <returns></returns>
        static bool RemoteCreateDirectory(CommandEventArgs e, string title, Uri uri, SvnClient cl)
        {
            using (CreateDirectoryDialog createDialog = new CreateDirectoryDialog())
            {
                createDialog.Text = title; // Override dialog title with text from other dialog

                createDialog.NewDirectoryName = uri.ToString();
                createDialog.NewDirectoryReadonly = true;
                if (createDialog.ShowDialog(e.Context) == DialogResult.OK)
                {
                    // Create uri (including optional /trunk if required)
                    SvnCreateDirectoryArgs cdArg = new SvnCreateDirectoryArgs();
                    cdArg.CreateParents = true;
                    cdArg.LogMessage = createDialog.LogMessage;

                    cl.RemoteCreateDirectory(uri, cdArg);
                    return true;
                }

                return false; // bail out, we cannot continue without directory in the repository
            }
        }
Ejemplo n.º 14
0
		public override void Mkdir (string[] paths, string message, IProgressMonitor monitor)
		{
			SvnCreateDirectoryArgs args = new SvnCreateDirectoryArgs ();
			args.CreateParents = true;
			BindMonitor (args, monitor);
			List<Uri> uris = new List<Uri> ();
			foreach (string path in paths)
				uris.Add (new Uri (path));
			args.LogMessage = message;
			lock (client) 
				client.RemoteCreateDirectories (uris, args);
		}
Ejemplo n.º 15
0
        public void PostCommitErrorTest()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri uri = sbox.CreateRepository(SandBoxRepository.Empty);
            using (InstallHook(uri, SvnHookType.PostCommit, OnPostCommit))
            {
                using (SvnClient cl = new SvnClient())
                {
                    SvnCommitResult cr;
                    SvnCreateDirectoryArgs da = new SvnCreateDirectoryArgs();
                    da.CreateParents = true;
                    da.LogMessage = "Created!";
                    cl.RemoteCreateDirectory(new Uri(uri, "a/b/c/d/e/f"), da, out cr);

                    Assert.That(cr, Is.Not.Null);
                    Assert.That(cr.PostCommitError.Contains(Environment.NewLine));
                    Assert.That(cr.PostCommitError.Substring(
                                                    cr.PostCommitError.IndexOf(Environment.NewLine, StringComparison.OrdinalIgnoreCase)
                                                    + Environment.NewLine.Length),
                                            Is.EqualTo("The Post Commit Warning"));
                }
            }
        }
Ejemplo n.º 16
0
		public override void Mkdir (string[] paths, string message, ProgressMonitor monitor)
		{
			var args = new SvnCreateDirectoryArgs {
				CreateParents = true,
				LogMessage = message,
			};
			BindMonitor (monitor);
			var uris = paths.Select (p => new Uri (p)).ToArray ();
			lock (client) 
				client.RemoteCreateDirectories (uris, args);
		}