Ejemplo n.º 1
0
        public override void OnExecute(CommandEventArgs e)
        {
            ISvnRepositoryItem selected = EnumTools.GetSingle(e.Selection.GetSelection<ISvnRepositoryItem>());

            if (selected == null)
                return;

            Uri uri = selected.Uri;
            string name = selected.Origin.Target.FileName;

            IAnkhSolutionSettings ss = e.GetService<IAnkhSolutionSettings>();

            using (CheckoutDialog dlg = new CheckoutDialog())
            {
                dlg.Context = e.Context;
                dlg.Uri = uri;
                dlg.LocalPath = System.IO.Path.Combine(ss.NewProjectLocation, name);

                if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                    return;

                e.GetService<IProgressRunner>().RunModal("Checking Out",
                    delegate(object sender, ProgressWorkerArgs a)
                    {
                        SvnCheckOutArgs args = new SvnCheckOutArgs();
                        args.Revision = dlg.Revision;
                        args.Depth = dlg.Recursive ? SvnDepth.Infinity : SvnDepth.Files;
                        args.IgnoreExternals = dlg.IgnoreExternals;

                        a.Client.CheckOut(dlg.Uri, dlg.LocalPath, args);
                    });
            }
        }
Ejemplo n.º 2
0
        public override string CheckOut(IPackageTree packageTree, FileSystemInfo destination)
        {
            SvnUpdateResult result = null;

            using (var client = new SvnClient())
            {
                try
                {
                    var svnOptions = new SvnCheckOutArgs();
                    if (UseRevision.HasValue)
                        svnOptions.Revision = new SvnRevision(UseRevision.Value);
                    client.CheckOut(new SvnUriTarget(new Uri(Url)), destination.FullName, svnOptions, out result);
                }
                catch (SvnRepositoryIOException sre)
                {
                    HandleExceptions(sre);
                }
                catch (SvnObstructedUpdateException sue)
                {
                    HandleExceptions(sue);
                }
            }

            return result.Revision.ToString();
        }
Ejemplo n.º 3
0
        public void Resolve_RepeatedEventHookUp_SOC_411()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri projectRoot = new Uri("https://ctf.open.collab.net/svn/repos/sharpsvn/trunk/scripts");

            using (var svnClient = new SvnClient())
            {
                for (int i = 0; i < 3; i++)
                {
                    string workingcopy = sbox.GetTempDir();
                    Directory.CreateDirectory(workingcopy);

                    svnClient.Authentication.UserNamePasswordHandlers += DoNowt;
                    try
                    {
                        SvnUpdateResult svnUpdateResult;
                        SvnCheckOutArgs ca = new SvnCheckOutArgs() { Depth = SvnDepth.Files };
                        Assert.IsTrue(svnClient.CheckOut(projectRoot, workingcopy, ca, out svnUpdateResult));
                        Assert.IsNotNull(svnUpdateResult);
                        Assert.IsTrue(svnUpdateResult.HasRevision);
                    }
                    finally
                    {
                        svnClient.Authentication.UserNamePasswordHandlers -= DoNowt;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void CheckOut_ProgressEvent()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            string newWc = sbox.GetTempDir();
            SvnCheckOutArgs a = new SvnCheckOutArgs();
            bool progressCalled = false;
            a.Progress += delegate(object sender, SvnProgressEventArgs e) { progressCalled = true; };
            a.Depth = SvnDepth.Empty;
            this.Client.CheckOut(new Uri("http://svn.apache.org/repos/asf/subversion/"), newWc, a);

            Assert.That(progressCalled, "Progress delegate not called");
        }
Ejemplo n.º 5
0
        public void CheckOut_BasicCheckout()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri ReposUrl = sbox.CreateRepository(SandBoxRepository.AnkhSvnCases);
            string newWc = sbox.Wc;
            SvnCheckOutArgs a = new SvnCheckOutArgs();
            this.Client.CheckOut(new Uri(ReposUrl, "trunk/"), newWc, a);

            Assert.That(File.Exists(Path.Combine(newWc, "Form.cs")),
                "Checked out file not there");
            Assert.That(Directory.Exists(Path.Combine(newWc, SvnClient.AdministrativeDirectoryName)),
                "No admin directory found");
            Assert.That(this.RunCommand("svn", "st \"" + newWc + "\"").Trim(), Is.EqualTo(""),
                "Wrong status");
        }
Ejemplo n.º 6
0
 static public void Checkout(Uri fromUri, string localPath, SvnDepth depth)
 {
     using (SvnClient svnClient = new SvnClient())
     {
         try
         {
             SvnCheckOutArgs args = new SvnCheckOutArgs();
             args.Depth = depth;
             svnClient.CheckOut(fromUri, localPath, args);
         }
         catch (Exception ex)
         {
             LogMessage(ex.Message);
         }
     }
 }
Ejemplo n.º 7
0
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            if (tbLocalPath.Text.Length == 0 || tbRepoURI.Text.Length == 0)
            {
                MessageBox.Show("repository ve localpath alanları boş olamaz");
                return;
            }
            SvnUpdateResult result;
            long            revision;
            SvnCheckOutArgs args = new SvnCheckOutArgs();
            string          path = tbLocalPath.Text;

            if (long.TryParse(tbRevision.Text, out revision))
            {
                args.Revision = new SvnRevision(revision);
            }
            else
            {
                MessageBox.Show("geçersiz revizyon numarası ,varsayılan HEAD");
            }
            using (SvnClient client = new SvnClient())//SVN deposu için sarmalayıcı sınıf
            {
                try
                {
                    SvnUriTarget target = new SvnUriTarget(tbRepoURI.Text);
                    if (client.CheckOut(target, path, args, out result))
                    {
                        MessageBox.Show("basarılı" + result.Revision + ".");
                    }
                }
                catch (SvnException se)
                {
                    MessageBox.Show(se.Message, "SVN checkout error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                catch (UriFormatException ufe)
                {
                    MessageBox.Show(ufe.Message, "SVN checkout error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 8
0
        private void Checkout(long?rev = null)
        {
            //SvnCheckoutArgs wraps all of the options for the 'svn checkout' function
            SvnCheckOutArgs args = new SvnCheckOutArgs();

            args.Progress += this.OnProgress;
            args.SvnError += this.OnSvnError;
            args.Notify   += this.OnNotify;

            //the using statement is necessary to ensure we are freeing up resources
            using (SvnClient client = new SvnClient())
            {
                try
                {
                    //SvnUriTarget is a wrapper class for SVN repository URIs
                    SvnUriTarget target = rev == null ? new SvnUriTarget(this.repository.Uri) : new SvnUriTarget(this.repository.Uri, rev);

                    client.Authentication.ForceCredentials(this.username, this.ownerPassword);
                    //this is the where 'svn checkout' actually happens.

                    //SvnUpdateResult provides info about what happened during a checkout
                    SvnUpdateResult result;
                    if (client.CheckOut(target, this.repoPath, args, out result))
                    {
                        Logging.Log().Information($"Successfully checked out revision {result.Revision}.");
                        this.syncLogger.Log(this.sync, $"Successfully checked out revision {result.Revision}.");
                    }
                }
                catch (SvnException se)
                {
                    Logging.Log().Error(se, "SVN checkout failed.");
                    this.syncLogger.Log(this.sync, $"SVN checkout failed. {se}");

                    throw;
                }
                catch (UriFormatException ufe)
                {
                    Logging.Log().Error(ufe, "SVN uri format.");
                    this.syncLogger.Log(this.sync, $"SVN uri format. {ufe}");

                    throw;
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Реинтеграция фитчи в родительскую ветку
        /// </summary>
        public void ReintegrationMergeToBaseBranch()
        {
            string baseWorkingCopyPath = BaseWorkingCopyPath ?? WorkingCopyPath + "_Release";
            string baseWorkingCopyUrl  =
                GetBaseBranchPath(GetFeatureFirstRevisionNumber(WorkingCopyPath), WorkingCopyPath);
            var svnCheckOutArgs = new SvnCheckOutArgs();

            svnCheckOutArgs.Notify += SvnCheckOutArgsOnNotify;
            try {
                CheckOut(SvnUriTarget.FromString(baseWorkingCopyUrl), baseWorkingCopyPath, svnCheckOutArgs);
            } finally {
                svnCheckOutArgs.Notify -= SvnCheckOutArgsOnNotify;
            }

            Info(SvnTarget.FromString(WorkingCopyPath), (sender, args) => { });

            var svnReintegrationMergeArgs = new SvnReintegrationMergeArgs();

            svnReintegrationMergeArgs.Notify   += SvnReintegrationMergeArgsOnNotify;
            svnReintegrationMergeArgs.Conflict += SvnReintegrationMergeArgsOnConflict;

            try {
                string workingCopyUrl = string.Empty;
                Info(WorkingCopyPath, new SvnInfoArgs {
                    Revision = new SvnRevision(SvnRevisionType.Head)
                }
                     , (sender, args) => workingCopyUrl = args.Uri.ToString());
                ReintegrationMerge(baseWorkingCopyPath
                                   , SvnTarget.FromString(workingCopyUrl)
                                   , svnReintegrationMergeArgs);
            } catch (SvnClientNotReadyToMergeException e) {
                Logger.LogError(e.Message, e.Targets.ToString());
            } finally {
                svnReintegrationMergeArgs.Notify   -= SvnReintegrationMergeArgsOnNotify;
                svnReintegrationMergeArgs.Conflict -= SvnReintegrationMergeArgsOnConflict;
            }

            RemovePackageProperty(baseWorkingCopyPath);
        }
Ejemplo n.º 10
0
        public override void OnExecute(CommandEventArgs e)
        {
            ISvnRepositoryItem selected = EnumTools.GetSingle(e.Selection.GetSelection <ISvnRepositoryItem>());

            if (selected == null)
            {
                return;
            }

            Uri    uri  = selected.Uri;
            string name = selected.Origin.Target.FileName;

            IAnkhSolutionSettings ss = e.GetService <IAnkhSolutionSettings>();

            using (CheckoutDialog dlg = new CheckoutDialog())
            {
                dlg.Context        = e.Context;
                dlg.Uri            = uri;
                dlg.RepositoryRoot = selected.Origin.RepositoryRoot;
                dlg.LocalPath      = System.IO.Path.Combine(ss.NewProjectLocation, name);

                if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                {
                    return;
                }

                e.GetService <IProgressRunner>().RunModal(CommandStrings.CheckingOut,
                                                          delegate(object sender, ProgressWorkerArgs a)
                {
                    SvnCheckOutArgs args = new SvnCheckOutArgs();
                    args.Revision        = dlg.Revision;
                    args.Depth           = dlg.Recursive ? SvnDepth.Infinity : SvnDepth.Files;
                    args.IgnoreExternals = dlg.IgnoreExternals;

                    a.Client.CheckOut(dlg.Uri, dlg.LocalPath, args);
                });
            }
        }
Ejemplo n.º 11
0
        protected override void ExecuteSVNTask(SvnClient client)
        {
            if (Dir.Exists && !IsEmpty(Dir))
            {
                throw new BuildException(string.Format(Resources.SVNCheckoutEmptyDirectory, Dir.FullName), Location);
            }

            Log(Level.Info, Resources.SVNCheckingOut, Url, Dir.FullName);
            SvnCheckOutArgs args = new SvnCheckOutArgs();
            args.ThrowOnError = true;
            args.Depth = SvnDepth.Infinity;
            args.Revision = SvnRevision.Head;
            SvnUpdateResult result;

            bool conflictedFiles = false;
            client.Conflict += delegate(object sender, SvnConflictEventArgs conflictArgs)
                                    {
                                        conflictedFiles = true;
                                        Log(Level.Warning, string.Concat(@"Conflicted: ", conflictArgs.Path));
                                    };

            client.Notify += delegate(object sender, SvnNotifyEventArgs notifyArgs)
                                    {
                                        Log(Level.Info, string.Concat(notifyArgs.Action, ": ", notifyArgs.Path));
                                    };

            client.CheckOut(SvnUriTarget.FromUri(Url), Dir.FullName, args, out result);

            if (conflictedFiles)
            {
                throw new BuildException(string.Format(Resources.SVNConflict, Dir.FullName));
            }

            if (result != null)
            {
                Log(Level.Info, Resources.SVNCheckedOut, Dir.FullName, result.Revision);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Actual method to be executed for the implementing task
        /// </summary>
        /// <param name="client">The instance of the SVN client</param>
        /// <returns></returns>
        public override bool ExecuteCommand(SvnClient client)
        {
            SvnUriTarget uriTarget = new SvnUriTarget(RepositoryUrl);
            SvnCheckOutArgs checkOutArgs = new SvnCheckOutArgs();
            checkOutArgs.Depth = GetDepth();
            checkOutArgs.IgnoreExternals = IgnoreExternals;
            checkOutArgs.Revision = RevisionParser.SafeParse(Revision);

            SvnUpdateResult result;

            bool success = client.CheckOut(uriTarget, RepositoryPath, checkOutArgs, out result);

            if (result.HasRevision)
            {
                CheckedRevision = result.Revision;
                Log.LogMessage(MessageImportance.Normal, "Checked revision: {0}", CheckedRevision);
            }
            if (result.HasResultMap)
            {
                ReadResults(result);
            }

            return success;
        }
Ejemplo n.º 13
0
		public override void Checkout (string url, FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
		{
			SvnCheckOutArgs args = new SvnCheckOutArgs ();
			BindMonitor (args, monitor);
			args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
			lock (client) {
				try {
					client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
				} catch (SvnOperationCanceledException) {
					if (Directory.Exists (path.ParentDirectory))
						FileService.DeleteDirectory (path.ParentDirectory);
				}
			}
		}
Ejemplo n.º 14
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (tbLocalPath.Text.Length == 0 || tbRepoURI.Text.Length == 0)
            {
                this.txtStatus.ForeColor = Color.Red;
                this.txtStatus.Text      = "'远程仓库 URI' 和 '本地路径' 不能为空!";
            }
            else
            {
                if (Directory.Exists(this.tbLocalPath.Text))
                {
                    SvnUpdateResult result;
                    long            revision;
                    SvnCheckOutArgs args = new SvnCheckOutArgs();
                    string          path = tbLocalPath.Text;
                    if (long.TryParse(tbRevision.Text, out revision))
                    {
                        //set the revision number if the user entered a valid number
                        args.Revision = new SvnRevision(revision);
                    }
                    else
                    {
                        this.txtStatus.ForeColor = Color.Red;
                        this.txtStatus.Text      = "无效的版本号,默认为HEAD!";
                    }

                    using (SvnClient client = new SvnClient())
                    {
                        myTimer.Start();
                        for (int i = 0; i < 100; i++)
                        {
                            System.Threading.Thread.Sleep(100);
                            progCheckOut.Value++;
                        }
                        try
                        {
                            //SvnUriTarget is a wrapper class for SVN repository URIs
                            SvnUriTarget target = new SvnUriTarget(tbRepoURI.Text);

                            //this is the where 'svn checkout' actually happens.
                            if (client.CheckOut(target, path, args, out result))
                            {
                                this.txtStatus.ForeColor = Color.Green;
                                this.txtStatus.Text      = "成功检出版本:" + result.Revision + ".";
                            }
                        }
                        catch (SvnException se)
                        {
                            MessageBox.Show("版本检出异常:" + se.Message, "异常消息提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        catch (UriFormatException ufe)
                        {
                            MessageBox.Show("版本检出异常:" + ufe.Message, "异常消息提示:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    this.txtStatus.ForeColor = Color.Red;
                    this.txtStatus.Text      = "无效的文件路径!请确认路径是否填写正确!";
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// While the server isn't up to date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doSvnUpdate(object sender, DoWorkEventArgs e)
        {
            client = new SvnClient();
            client.Notify += onSvnNotify;
            client.Authentication.Clear();
            client.Authentication.DefaultCredentials = null;

            System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()));

            Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory());
            Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/");

            if (rep == null || rep != rel)
            {
                SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory());
                exploreDirectory(rel);

                download.Maximum = iCount;
                updating = true;

                SvnCheckOutArgs args = new SvnCheckOutArgs();
                args.AllowObstructions = true;

                if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult))
                {
                    updated = true;
                }

            }
            else
            {
                downloadprogress.Text = "Building update list, please be patient...";

                updating = true;
                SvnStatusArgs sa = new SvnStatusArgs();
                sa.RetrieveRemoteStatus = true;

                Collection<SvnStatusEventArgs> r;
                client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r);

                foreach (SvnStatusEventArgs i in r)
                {
                    client.Revert(i.FullPath);

                    if (i.IsRemoteUpdated)
                        iCount++;
                }

                download.Maximum = iCount;
                SvnUpdateArgs args = new SvnUpdateArgs();
                args.AllowObstructions = true;

                if (client.Update(System.IO.Directory.GetCurrentDirectory(), args))
                {
                    updated = true;
                }
                else
                {
                    Application.Exit();
                }
            }
        }
 private int Checkout(string repoUrl, string workingPath, SvnRevision revision, bool recurse, bool ignoreExternals)
 {
     try
     {
         SvnCheckOutArgs args = new SvnCheckOutArgs();
         args.Revision = revision;
         args.IgnoreExternals = ignoreExternals;
         args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
         SvnUpdateResult result;
         client.CheckOut(new Uri(repoUrl), workingPath, args, out result);
         return (int) result.Revision;
     }
     catch (Exception ex)
     {
         OnError(ex);
     }
     return int.MinValue;
 }
Ejemplo n.º 17
0
        static bool CheckoutWorkingCopyForSolution(CommandEventArgs e, ref bool confirmed)
        {
            using (SvnClient cl = e.GetService <ISvnClientPool>().GetClient())
                using (AddToSubversion dialog = new AddToSubversion())
                {
                    dialog.PathToAdd = e.Selection.SolutionFilename;
                    if (e.Argument is IAnkhSccService)
                    {
                        dialog.CommitAllVisible = false;
                        dialog.CommitAllFiles   = false;
                    }
                    else
                    {
                        dialog.CommitAllFiles = true;
                    }

                    if (dialog.ShowDialog(e.Context) != DialogResult.OK)
                    {
                        return(false); // Don't set as managed by AnkhSVN
                    }
                    confirmed = true;

                    if (dialog.CommitAllFiles)
                    {
                        HybridCollection <string> allFiles = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

                        string logMessage;
                        string wcPath   = dialog.WorkingCopyDir;
                        Uri    reposUrl = dialog.RepositoryAddUrl;

                        allFiles.UniqueAddRange(e.GetService <IProjectFileMapper>().GetAllFilesOfAllProjects(true));
                        using (CreateDirectoryDialog dlg = new CreateDirectoryDialog())
                        {
                            dlg.Text                 = CommandStrings.ImportingTitle;
                            dlg.NewDirectoryName     = dialog.RepositoryAddUrl.ToString();
                            dlg.NewDirectoryReadonly = true;

                            if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                            {
                                return(false);
                            }

                            logMessage = dlg.LogMessage;
                        }


                        IAnkhOpenDocumentTracker documentTracker = e.GetService <IAnkhOpenDocumentTracker>();

                        documentTracker.SaveDocuments(allFiles); // Make sure all files are saved before updating/merging!

                        using (DocumentLock lck = documentTracker.LockDocuments(allFiles, DocumentLockType.NoReload))
                            using (lck.MonitorChangesForReload())
                            {
                                e.GetService <IProgressRunner>().RunModal(CommandStrings.ImportingTitle,
                                                                          delegate(object sender, ProgressWorkerArgs a)
                                {
                                    SvnImportArgs importArgs = new SvnImportArgs();
                                    importArgs.LogMessage    = logMessage;
                                    importArgs.Filter       +=
                                        delegate(object ieSender, SvnImportFilterEventArgs ie)
                                    {
                                        if (ie.NodeKind != SvnNodeKind.Directory)
                                        {
                                            ie.Filter = !allFiles.Contains(ie.FullPath);
                                        }
                                        else
                                        {
                                            bool filter = true;
                                            foreach (string p in allFiles)
                                            {
                                                if (SvnItem.IsBelowRoot(p, ie.FullPath))
                                                {
                                                    filter = false;
                                                    break;
                                                }
                                            }
                                            if (filter)
                                            {
                                                ie.Filter = true;
                                            }
                                        }
                                    };
                                    a.Client.Import(wcPath, reposUrl, importArgs);
                                });
                            }
                    }
                    else
                    {
                        Collection <SvnInfoEventArgs> info;
                        SvnInfoArgs ia = new SvnInfoArgs();
                        ia.ThrowOnError = false;
                        if (!cl.GetInfo(dialog.RepositoryAddUrl, ia, out info))
                        {
                            // Target uri doesn't exist in the repository, let's create
                            if (!RemoteCreateDirectory(e, dialog.Text, dialog.RepositoryAddUrl, cl))
                            {
                                return(false); // Create failed; bail out
                            }
                        }

                        // Create working copy
                        SvnCheckOutArgs coArg = new SvnCheckOutArgs();
                        coArg.AllowObstructions = true;
                        cl.CheckOut(dialog.RepositoryAddUrl, dialog.WorkingCopyDir, coArg);

                        // Add solutionfile so we can set properties (set managed)
                        AddPathToSubversion(e, e.Selection.SolutionFilename);

                        IAnkhSolutionSettings settings = e.GetService <IAnkhSolutionSettings>();
                        IProjectFileMapper    mapper   = e.GetService <IProjectFileMapper>();
                        IFileStatusMonitor    monitor  = e.GetService <IFileStatusMonitor>();

                        settings.ProjectRoot = SvnTools.GetNormalizedFullPath(dialog.WorkingCopyDir);

                        if (monitor != null && mapper != null)
                        {
                            // Make sure all visible glyphs are updated to reflect a new working copy
                            monitor.ScheduleSvnStatus(mapper.GetAllFilesOfAllProjects());
                        }
                    }

                    return(true);
                }
        }
Ejemplo n.º 18
0
        private void btnCheckout_Click(object sender, EventArgs e)
        {
            if (tbLocalPath.Text.Length == 0 || tbRepoURI.Text.Length == 0)
            {
                MessageBox.Show("The 'Repository URI' and 'Local Path' fields cannot be empty.");
                return;
            }

            //SvnUpdateResult provides info about what happened during a checkout
            SvnUpdateResult result;

            //we will use this to tell CheckOut() which revision to fetch
            long revision;

            //SvnCheckoutArgs wraps all of the options for the 'svn checkout' function
            SvnCheckOutArgs args = new SvnCheckOutArgs();

            //path is the path where the local working copy will end up
            string path = tbLocalPath.Text;

            if (long.TryParse(tbRevision.Text, out revision))
            {
                //set the revision number if the user entered a valid number
                args.Revision = new SvnRevision(revision);
            }
            //if args.Revision is not set, it defaults to fetch the HEAD revision.
            else
            {
                MessageBox.Show("Invalid Revision number, defaulting to HEAD");
            }

            //the using statement is necessary to ensure we are freeing up resources
            using (SharpSvn.SvnClient client = new SharpSvn.SvnClient())
            {
                try
                {
                    //SvnUriTarget is a wrapper class for SVN repository URIs
                    SvnUriTarget target = new SvnUriTarget(tbRepoURI.Text);

                    if (cbAuthenticate.Checked == true)
                    {
                        logMsg("Authenticating");
                        client.Authentication.Clear(); // Clear a previous authentication

                        client.Authentication.SslServerTrustHandlers += new EventHandler <SharpSvn.Security.SvnSslServerTrustEventArgs>(SVN_SSL_Override);

                        client.Authentication.UserNamePasswordHandlers += delegate(object obj, SharpSvn.Security.SvnUserNamePasswordEventArgs val)
                        {
                            val.UserName = textUserid.Text;
                            val.Password = textPassword.Text;
                            val.Save     = true;
                        };
                    }
                    logMsg("Checking out from:");
                    logMsg(tbRepoURI.Text);

                    //this is the where 'svn checkout' actually happens.

                    if (client.CheckOut(target, path, args, out result))
                    {
                        MessageBox.Show("Successfully checked out revision " + result.Revision + ".");
                        logMsg("Successfully checked out revision " + result.Revision + ".");
                    }
                }
                catch (SvnException se)
                {
                    MessageBox.Show(textUserid.Text + " " + textPassword.Text + " " + se.Message,
                                    "svn checkout error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    logMsg("svn error code: " + se.SubversionErrorCode);
                    logMsg("SvnErrorCategory: " + se.SvnErrorCategory);
                    logMsg(se.StackTrace);
                }
                catch (UriFormatException ufe)
                {
                    MessageBox.Show(ufe.Message,
                                    "svn checkout error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Returns false if the AddToSubversionDialog has been cancelled, true otherwise
        /// </summary>
        /// <param name="e"></param>
        /// <param name="projectInfo"></param>
        /// <param name="solutionReposRoot"></param>
        /// <param name="shouldMarkAsManaged"></param>
        /// <param name="storeReference"></param>
        /// <returns></returns>
        static bool CheckoutWorkingCopyForProject(CommandEventArgs e, SccProject project, ISccProjectInfo projectInfo, Uri solutionReposRoot, out bool shouldMarkAsManaged, out bool storeReference)
        {
            shouldMarkAsManaged = false;
            storeReference      = false;
            using (SvnClient cl = e.GetService <ISvnClientPool>().GetClient())
                using (AddProjectToSubversion dialog = new AddProjectToSubversion())
                {
                    dialog.Context          = e.Context;
                    dialog.PathToAdd        = projectInfo.ProjectDirectory;
                    dialog.RepositoryAddUrl = solutionReposRoot;

                    if (e.Argument is IAnkhSccService)
                    {
                        dialog.CommitAllVisible = false;
                        dialog.CommitAllFiles   = false;
                    }
                    else
                    {
                        dialog.CommitAllFiles = true;
                    }

                    if (dialog.ShowDialog(e.Context) != DialogResult.OK)
                    {
                        return(false); // User cancelled the "Add to subversion" dialog, don't set as managed by Ankh
                    }
                    if (!dialog.CommitAllFiles)
                    {
                        Collection <SvnInfoEventArgs> info;
                        SvnInfoArgs ia = new SvnInfoArgs();
                        ia.ThrowOnError = false;
                        if (!cl.GetInfo(dialog.RepositoryAddUrl, ia, out info))
                        {
                            // Target uri doesn't exist in the repository, let's create
                            if (!RemoteCreateDirectory(e, dialog.Text, dialog.RepositoryAddUrl, cl))
                            {
                                return(false); // Create failed; bail out
                            }
                        }

                        // Create working copy
                        SvnCheckOutArgs coArg = new SvnCheckOutArgs();
                        coArg.AllowObstructions = true;
                        cl.CheckOut(dialog.RepositoryAddUrl, dialog.WorkingCopyDir, coArg);
                    }
                    else
                    {
                        // Cache some values before thread marshalling
                        HybridCollection <string> projectFiles = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);
                        string wcDir    = dialog.WorkingCopyDir;
                        Uri    reposUrl = dialog.RepositoryAddUrl;
                        string logMessage;

                        projectFiles.UniqueAddRange(e.GetService <IProjectFileMapper>().GetAllFilesOf(project));
                        using (CreateDirectoryDialog dlg = new CreateDirectoryDialog())
                        {
                            dlg.Text                 = CommandStrings.ImportingTitle;
                            dlg.NewDirectoryName     = reposUrl.ToString();
                            dlg.NewDirectoryReadonly = true;

                            if (dlg.ShowDialog(e.Context) != DialogResult.OK)
                            {
                                return(false);
                            }

                            logMessage = dlg.LogMessage;
                        }
                        IAnkhOpenDocumentTracker documentTracker = e.GetService <IAnkhOpenDocumentTracker>();

                        documentTracker.SaveDocuments(projectFiles); // Make sure all files are saved before updating/merging!

                        using (DocumentLock lck = documentTracker.LockDocuments(projectFiles, DocumentLockType.NoReload))
                            using (lck.MonitorChangesForReload())
                            {
                                e.GetService <IProgressRunner>().RunModal(CommandStrings.ImportingTitle,
                                                                          delegate(object sender, ProgressWorkerArgs a)
                                {
                                    SvnImportArgs importArgs = new SvnImportArgs();
                                    importArgs.LogMessage    = logMessage;
                                    importArgs.Filter       +=
                                        delegate(object ieSender, SvnImportFilterEventArgs ie)
                                    {
                                        if (ie.NodeKind != SvnNodeKind.Directory)
                                        {
                                            ie.Filter = !projectFiles.Contains(ie.FullPath);
                                        }
                                        else
                                        {
                                            bool filter = true;
                                            foreach (string p in projectFiles)
                                            {
                                                if (SvnItem.IsBelowRoot(p, ie.FullPath))
                                                {
                                                    filter = false;
                                                    break;
                                                }
                                            }
                                            if (filter)
                                            {
                                                ie.Filter = true;
                                            }
                                        }
                                    };
                                    a.Client.Import(wcDir, reposUrl, importArgs);
                                });
                            }
                    }

                    shouldMarkAsManaged = dialog.MarkAsManaged;
                    storeReference      = dialog.WriteCheckOutInformation;
                }
            return(true);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Returns false if the AddToSubversionDialog has been cancelled, true otherwise
        /// </summary>
        /// <param name="e"></param>
        /// <param name="projectInfo"></param>
        /// <param name="solutionReposRoot"></param>
        /// <param name="shouldMarkAsManaged"></param>
        /// <param name="storeReference"></param>
        /// <returns></returns>
        static bool CheckoutWorkingCopyForProject(CommandEventArgs e, ISvnProjectInfo projectInfo, Uri solutionReposRoot, out bool shouldMarkAsManaged, out bool storeReference)
        {
            shouldMarkAsManaged = false;
            storeReference = false;
            using (SvnClient cl = e.GetService<ISvnClientPool>().GetClient())
            using (AddProjectToSubversion dialog = new AddProjectToSubversion())
            {
                dialog.Context = e.Context;
                dialog.PathToAdd = projectInfo.ProjectDirectory;
                dialog.RepositoryAddUrl = solutionReposRoot;
                if (dialog.ShowDialog(e.Context) != DialogResult.OK)
                    return false; // User cancelled the "Add to subversion" dialog, don't set as managed by Ankh

                Collection<SvnInfoEventArgs> info;
                SvnInfoArgs ia = new SvnInfoArgs();
                ia.ThrowOnError = false;
                if (!cl.GetInfo(dialog.RepositoryAddUrl, ia, out info))
                {
                    // Target uri doesn't exist in the repository, let's create
                    if (!RemoteCreateDirectory(e, dialog.Text, dialog.RepositoryAddUrl, cl))
                        return false; // Create failed; bail out
                }

                // Create working copy
                SvnCheckOutArgs coArg = new SvnCheckOutArgs();
                coArg.AllowObstructions = true;
                cl.CheckOut(dialog.RepositoryAddUrl, dialog.WorkingCopyDir, coArg);

                shouldMarkAsManaged = dialog.MarkAsManaged;
                storeReference = dialog.WriteCheckOutInformation;
            }
            return true;
        }
Ejemplo n.º 21
0
        private static bool ImportDirectories()
        {
            var    uri = new Uri(string.Format("{0}{1}", svnURL, svnPROJ));
            string dir = Path.Combine(repoDIR, vssPROJ.Substring(2).Replace("/", "\\"));

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            using (SvnClient svnClient = GetSvnClient())
            {
                var importArgs = new SvnImportArgs
                {
                    LogMessage = string.Format("Initial import from VSS on {0}", DateTime.Now)
                };

                SvnInfoEventArgs infoEventArgs;
                try
                {
                    trunkexists = svnClient.GetInfo(SvnTarget.FromUri(uri), out infoEventArgs);
                    migrateLog.DebugFormat(svnClient.GetInfo(SvnTarget.FromUri(uri), out infoEventArgs) ?
                                           "Getting trunk revision was successful." :
                                           "Getting trunk revision was NOT successful!");

                    migrateLog.DebugFormat("Base Revision: " + infoEventArgs.Revision);

                    if (infoEventArgs.Revision == 0)
                    {
                        if (!svnClient.Import(dir, uri, importArgs))
                        {
                            return(false);
                        }
                    }
                }
                catch (Exception)
                {
                    if (!svnClient.Import(dir, uri, importArgs))
                    {
                        return(false);
                    }
                }

                var tagurl    = new Uri(String.Format("{1}/{0}", svnTAG, svnURL));
                var branchurl = new Uri(String.Format("{1}/{0}", svnBRANCH, svnURL));

                try
                {
                    svnClient.GetInfo(tagurl, out infoEventArgs);
                    svnClient.GetInfo(branchurl, out infoEventArgs);
                    migrateLog.DebugFormat(svnClient.GetInfo(tagurl, out infoEventArgs)?
                                           "Getting tag dir revision was successful." :
                                           "Getting tag dir revision was NOT successful!");

                    migrateLog.DebugFormat(svnClient.GetInfo(branchurl, out infoEventArgs)?
                                           "Getting branch dir revision was successful." :
                                           "Getting branch dir revision was NOT successful!");
                }
                catch (SvnRepositoryIOException)
                {
                    var tagdircreated = svnClient.RemoteCreateDirectory((tagurl), new SvnCreateDirectoryArgs
                    {
                        LogMessage = "Initial creation of tag directory", CreateParents = true
                    });
                    var branchdircreated = svnClient.RemoteCreateDirectory((branchurl),
                                                                           new SvnCreateDirectoryArgs
                    {
                        LogMessage = "Initial creation of branch directory", CreateParents = true
                    });
                }

                try
                {
                    svnClient.GetInfo(uri, out infoEventArgs);
                }
                catch (SvnRepositoryIOException)
                {
                    svnClient.RemoteCreateDirectory((uri),
                                                    new SvnCreateDirectoryArgs
                    {
                        LogMessage = "Initial import", CreateParents = true
                    });
                }


                migrateLog.DebugFormat(dir);
                //Update the author and time of the first import revision to correspond to the first file revision
                //minus a minute in time for proper ordering of the revisions in time);
                if (!string.IsNullOrEmpty(svnREVPROPSPATH))
                {
                    svnClient.GetInfo(trunkexists
                                          ? SvnTarget.FromUri(uri)
                                          : SvnTarget.FromString(dir),
                                      out infoEventArgs);

                    var props = new SvnRevProps(svnREVPROPSPATH, infoEventArgs.Revision);

                    //This helps to make sure the revisions are imported in chronological order
                    props.SetDate(revisions.Keys[0].Time.AddMinutes(-1));
                }

                Cleanup();

                var checkOutArgs = new SvnCheckOutArgs {
                    Depth = SvnDepth.Infinity
                };
                return(svnClient.CheckOut(uri, dir, checkOutArgs));
            }
        }
Ejemplo n.º 22
0
        private void checkoutButton_Click(object sender, EventArgs e)
        {
            if (!busy)
            {
                if (repoAddressTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Fill in 'Repository Address', click Fetch and select a tag from the list.", "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (tagList.SelectedItems.Count == 0 || tagList.SelectedItems[0].Text.Length == 0)
                {
                    MessageBox.Show("Select a tag from the list.", "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (checkoutFolderTextBox.Text.Length == 0)
                {
                    MessageBox.Show("Click Browse and choose a checkout folder.", "Parameter Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                Cursor.Current = Cursors.WaitCursor;
                checkoutLogRTB.Clear();
                cancel = false;
                busy = true;
                cancelButton.Visible = true;

                string tagName = tagList.SelectedItems[0].Text;
                string checkoutFolderBase = checkoutFolderTextBox.Text.TrimEnd('\\');
                string checkoutFolder = string.Format("{0}\\{1}", checkoutFolderBase, tagName);

                string baseUri = repoAddressTextBox.Text.TrimEnd('/');
                string fullUri = string.Format("{0}/{1}", baseUri, tagName);

                SvnCheckOutArgs args = new SvnCheckOutArgs();
                args.Notify += delegate(object sendern, SvnNotifyEventArgs en)
                {
                    appendRTB(en.Action + ": " + en.Path + Environment.NewLine);
                };

                args.Cancel += delegate(object senderc, SvnCancelEventArgs ec)
                {
                    ec.Cancel = cancel;
                };

                WorkerArguments workerArguments;
                workerArguments.uri = fullUri;
                workerArguments.checkoutFolder = checkoutFolder;
                workerArguments.checkoutArgs = args;

                backgroundWorker1.RunWorkerAsync(workerArguments);
            }
        }
Ejemplo n.º 23
0
        private static void PerformCheckout(ProgressWorkerArgs e, SvnUriTarget projectTop, SvnRevision revision, string localDir)
        {
            SvnCheckOutArgs a = new SvnCheckOutArgs();
            a.Revision = revision;

            e.Client.CheckOut(projectTop, localDir, a);
        }
		public override void Checkout (string url, FilePath path, Revision rev, bool recurse, IProgressMonitor monitor)
		{
			SvnCheckOutArgs args = new SvnCheckOutArgs ();
			BindMonitor (args, monitor);
			args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Empty;
			lock (client)
				client.CheckOut (new SvnUriTarget (url, GetRevision (rev)), path);
		}
Ejemplo n.º 25
0
        /// <summary>
        /// While the server isn't up to date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doSvnUpdate(object sender, DoWorkEventArgs e)
        {
            client         = new SvnClient();
            client.Notify += onSvnNotify;
            client.Authentication.Clear();
            client.Authentication.DefaultCredentials = null;

            System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()));

            Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory());
            Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/");

            if (rep == null || rep != rel)
            {
                SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory());
                exploreDirectory(rel);

                download.Maximum = iCount;
                updating         = true;

                SvnCheckOutArgs args = new SvnCheckOutArgs();
                args.AllowObstructions = true;

                if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult))
                {
                    updated = true;
                }
            }
            else
            {
                downloadprogress.Text = "Building update list, please be patient...";


                updating = true;
                SvnStatusArgs sa = new SvnStatusArgs();
                sa.RetrieveRemoteStatus = true;

                Collection <SvnStatusEventArgs> r;
                client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r);

                foreach (SvnStatusEventArgs i in r)
                {
                    client.Revert(i.FullPath);

                    if (i.IsRemoteUpdated)
                    {
                        iCount++;
                    }
                }

                download.Maximum = iCount;
                SvnUpdateArgs args = new SvnUpdateArgs();
                args.AllowObstructions = true;

                if (client.Update(System.IO.Directory.GetCurrentDirectory(), args))
                {
                    updated = true;
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Ejemplo n.º 26
0
        static bool CheckoutWorkingCopyForSolution(CommandEventArgs e, ref bool confirmed)
        {
            using (SvnClient cl = e.GetService<ISvnClientPool>().GetClient())
            using (AddToSubversion dialog = new AddToSubversion())
            {
                dialog.PathToAdd = e.Selection.SolutionFilename;
                if (dialog.ShowDialog(e.Context) == DialogResult.OK)
                {
                    confirmed = true;
                    Collection<SvnInfoEventArgs> info;
                    SvnInfoArgs ia = new SvnInfoArgs();
                    ia.ThrowOnError = false;
                    if (!cl.GetInfo(dialog.RepositoryAddUrl, ia, out info))
                    {
                        // Target uri doesn't exist in the repository, let's create
                        if (!RemoteCreateDirectory(e, dialog.Text, dialog.RepositoryAddUrl, cl))
                            return false; // Create failed; bail out
                    }

                    // Create working copy
                    SvnCheckOutArgs coArg = new SvnCheckOutArgs();
                    coArg.AllowObstructions = true;
                    cl.CheckOut(dialog.RepositoryAddUrl, dialog.WorkingCopyDir, coArg);

                    // Add solutionfile so we can set properties (set managed)
                    AddPathToSubversion(e, e.Selection.SolutionFilename);

                    IAnkhSolutionSettings settings = e.GetService<IAnkhSolutionSettings>();
                    IProjectFileMapper mapper = e.GetService<IProjectFileMapper>();
                    IFileStatusMonitor monitor = e.GetService<IFileStatusMonitor>();

                    settings.ProjectRoot = SvnTools.GetNormalizedFullPath(dialog.WorkingCopyDir);

                    if (monitor != null && mapper != null)
                    {
                        // Make sure all visible glyphs are updated to reflect a new working copy
                        monitor.ScheduleSvnStatus(mapper.GetAllFilesOfAllProjects());
                    }

                    return true;
                }

                return false; // User cancelled the "Add to subversion" dialog, don't set as managed by Ankh
            }
        }
Ejemplo n.º 27
0
        public void CheckOut_TestPeg()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri reposUri = sbox.CreateRepository(SandBoxRepository.DefaultBranched);
            Uri trunk = new Uri(reposUri, "trunk/");

            SvnUpdateResult result;
            Assert.That(Client.CheckOut(trunk, sbox.GetTempDir(), out result));

            Assert.That(result, Is.Not.Null);
            long head = result.Revision;

            Assert.That(Client.CheckOut(new SvnUriTarget(trunk, 1), sbox.GetTempDir(), out result));
            Assert.That(result.Revision, Is.EqualTo(1));

            SvnCheckOutArgs a = new SvnCheckOutArgs();
            a.Revision = 1;

            Assert.That(Client.CheckOut(new SvnUriTarget(new Uri(reposUri, "branches/trunk-r2"), 4), sbox.GetTempDir(), a, out result));
            Assert.That(result.Revision, Is.EqualTo(1));

            Assert.That(Client.CheckOut(trunk, sbox.GetTempDir(), a, out result));
            Assert.That(result.Revision, Is.EqualTo(1));
        }
Ejemplo n.º 28
0
        public bool Update()
        {
            if (m_loggedIn)
            {
                if (m_client == null || m_client.IsDisposed)
                    m_client = new SvnClient();
                if (m_strCheckoutPath == "")
                    return false;
                try
                {
                    SvnCheckOutArgs args = new SvnCheckOutArgs();
                    args.Depth = SvnDepth.Files;
                    args.IgnoreExternals = true;
                    m_client.CheckOut(m_uriRepository, m_strCheckoutPath, args);
                }
                catch (SvnException ex)
                {
                    String Msg = ex.Message + Environment.NewLine + Environment.NewLine +
                        "Host: " + m_uriRepository.Uri.Host + Environment.NewLine +
                        "Port: " + m_uriRepository.Uri.Port + Environment.NewLine +
                        "Path: " + m_uriRepository.Uri.AbsolutePath;

                    System.Windows.Forms.MessageBox.Show(Msg, "SVN Login Error", System.Windows.Forms.MessageBoxButtons.OK);
                    m_loggedIn = false;
                    return false;
                }
                try
                {
                    m_client.Update(m_strCheckoutPath);
                }
                catch (SvnException ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message, "SVN Update Error", System.Windows.Forms.MessageBoxButtons.OK);
                    m_loggedIn = false;
                    return false;
                }
                return true;
            }
            return false;
        }
Ejemplo n.º 29
0
        private static void Main(string[] args)
        {
            //SvnUpdateResult provides info about what happened during a checkout

            //we will use this to tell CheckOut() which revision to fetch

            //SvnCheckoutArgs wraps all of the options for the 'svn checkout' function
            SvnCheckOutArgs arguments = new SvnCheckOutArgs();
            bool tagOk = false;
            string tag = string.Empty;
            while (!tagOk)
            {
                Console.WriteLine("Tag: ");
                tag = Console.ReadLine();
                Regex twoDotPattern = new Regex("[0-9]*[.][0-9]*[.][0-9]*");
                if (string.IsNullOrEmpty(tag))
                {
                    Console.WriteLine("Tag vuoto.");
                }
                else
                {
                    if (!twoDotPattern.IsMatch(tag))
                    {
                        Console.WriteLine("Tag non corretto.");
                    }
                    else
                    {
                        tagOk = true;
                    }
                }
            }
            string reposUri = string.Format(ConfigurationManager.AppSettings["ReposUri"], tag);
            string defaultPath = ConfigurationManager.AppSettings["DefaultPath"];

            bool pathOk = false;
            string localPath = string.Empty;
            while (!pathOk)
            {
                try
                {
                    Console.WriteLine("Local path to checkout (default {0}): ", defaultPath);
                    string startingPath = Console.ReadLine();
                    if (string.IsNullOrEmpty(startingPath))
                    {
                        startingPath = defaultPath;
                    }
                    localPath = Path.Combine(startingPath, tag);

                    //Verifico se la dir è vuota
                    if(Directory.Exists(localPath))
                    {
                        string[] fileSystemEntries = Directory.GetFileSystemEntries(localPath);
                        if (fileSystemEntries.Length > 0)
                        {
                            throw new Exception("La directory non è vuota!");
                        }
                    }
                    pathOk = true;

                }
                catch (Exception e)
                {
                    Console.WriteLine("Errore: {0}", e.Message);
                    pathOk = false;
                }
            }

            Console.WriteLine("TAG: " + tag);
            Console.WriteLine("LOCAL PATH: " + localPath);
            Console.WriteLine("Repos URI: " + reposUri);

            Console.WriteLine("Prosegui? (Y/N)");
            if (Console.ReadLine().ToUpper() == "Y")
            {
                using (SvnClient client = new SvnClient())
                    try
                    {
                        //client.Processing +=new EventHandler<SvnProcessingEventArgs>(client_Processing);
                        //client.Committing +=new EventHandler<SvnCommittingEventArgs>(client_Committing);
                        //client.Progress += new EventHandler<SvnProgressEventArgs>(ClientProgress);
                        //SvnUriTarget is a wrapper class for SVN repository URIs
                        SvnUriTarget target = new SvnUriTarget(reposUri);
                        SvnUpdateResult result;
                        client.CheckOut(target, localPath, arguments, out result);
                        //client.Update(localPath, out result);
                        Console.WriteLine("OK: " + result);

                    }
                    catch (SvnException se)
                    {
                        Console.WriteLine(se.Message);
                        throw se;
                    }
                    catch (UriFormatException ufe)
                    {
                        Console.WriteLine(ufe.Message);
                        throw ufe;
                    }

                Console.WriteLine("Vuoi copiare i file di deploy sui server di produzione? (Y/N)");
                if (Console.ReadLine().ToUpper() == "Y")
                {
                    //Verifica dell'esistenza dei file di configurazione
                    string configurationFilesPath = Path.Combine(localPath, @"Build\ProductionConfigurations");
                    bool confOk = false;

                    string webDPCList = string.Empty;
                    while (!confOk)
                    {
                        try
                        {
                            Console.WriteLine("Elenco dei DPC separati da vigola: ");
                            webDPCList = Console.ReadLine();
                            foreach (string webDPCName in webDPCList.Split(','))
                            {
                                if (!File.Exists(Path.Combine(configurationFilesPath, webDPCName + ".xml")))
                                {
                                    throw new Exception(string.Format("Configurazione per il DPC {0} non trovata", webDPCName));
                                }
                            }
                            confOk = true;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                            confOk = false;
                        }
                    }

                    try
                    {
                        Executor executorDeploy = new Executor();
                        executorDeploy.WorkingDirectory = localPath + @"\Build";
                        executorDeploy.FileName = String.Format(string.Format(@"{0}\Build\nant\bin\NAnt.exe", localPath));
                        executorDeploy.Arguments = "CopyFilesOnServerDeploy -D:WebDPCList=" + webDPCList;
                        executorDeploy.ErrorMatchString = "BUILD FAILED";
                        executorDeploy.Exec();
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
            }

            Console.ReadLine();
        }