Ejemplo n.º 1
0
        public void Clean(IntPtr baton, SvnPath path, SvnWcStatus2 status)
        {
            if (status == null)
            {
                throw new ArgumentNullException("status");
            }

            if (status.TextStatus == SvnWcStatus.Kind.Unversioned || status.TextStatus == SvnWcStatus.Kind.Ignored)
            {
                string FullPath = Path.Combine(this.Directory, path.Value);

                if (File.Exists(FullPath))
                {
                    File.Delete(FullPath);
                }
                else if (System.IO.Directory.Exists(FullPath))
                {
                    That.Computer.FileSystem.DeleteDirectory(FullPath, Microsoft.VisualBasic.FileIO.DeleteDirectoryOption.DeleteAllContents);
                }
                else
                {
                    throw new BuildException(string.Format("Something fishy, {0}, does not seem to exist yet an svn status says it does.", FullPath), this.Location);
                }
            }
        }
Ejemplo n.º 2
0
 public void Record(IntPtr baton, SvnPath path, SvnWcStatus2 status)
 {
     if (path.Value.ToLower() == this.QueryPath.ToLower())
     {
         this.IsVersionedReturnValue = true;
         if (status.TextStatus == SvnWcStatus.Kind.Unversioned || status.TextStatus == SvnWcStatus.Kind.Ignored)
         {
             this.IsVersionedReturnValue = false;
         }
     }
 }
Ejemplo n.º 3
0
        public override async Task ExecuteAsync(IOperationExecutionContext context)
        {
            this.LogInformation("Executing SVN export...");
            var(c, r) = this.GetCredentialsAndResource(context);
            var client     = new SvnClient(context, c, this.SvnExePath, this);
            var sourcePath = new SvnPath(r?.RepositoryUrl, this.SourcePath);
            var result     = await client.ExportAsync(sourcePath, context.ResolvePath(this.DestinationPath), this.AdditionalArguments).ConfigureAwait(false);

            this.LogClientResult(result);

            this.LogInformation("SVN export executed.");
        }
Ejemplo n.º 4
0
        public override async Task ExecuteAsync(IOperationExecutionContext context)
        {
            this.LogInformation("Executing SVN delete...");
            var(c, r) = this.GetCredentialsAndResource(context);
            var client = new SvnClient(context, c, this.SvnExePath, this);
            var path   = new SvnPath(r?.RepositoryUrl, this.Path);
            var result = await client.DeleteAsync(path, this.Message, this.AdditionalArguments).ConfigureAwait(false);

            this.LogClientResult(result);

            this.LogInformation("SVN delete executed.");
        }
Ejemplo n.º 5
0
        private SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile, AprArray commitItems, IntPtr baton, AprPool pool)
        {
            if (!commitItems.IsNull)
            {
                foreach (SvnClientCommitItem2 item in commitItems)
                {
                    m_log.Debug("[SVNBACKUP]: ... " + Path.GetFileName(item.Path.ToString()) + " (" + item.Kind.ToString() + ") r" + item.Revision.ToString());
                }
            }

            string msg = "Region Backup (" + System.Environment.MachineName + " at " + DateTime.UtcNow + " UTC)";

            m_log.Debug("[SVNBACKUP]: Saved with message: " + msg);

            logMessage = new AprString(msg, pool);
            tmpFile    = new SvnPath(pool);

            return(SvnError.NoError);
        }
Ejemplo n.º 6
0
        public SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile,
                                             AprArray commitItems, IntPtr baton,
                                             AprPool pool)
        {
            if (!commitItems.IsNull)
            {
                foreach (SvnClientCommitItem item in commitItems)
                {
                    Console.WriteLine("C1: {1} ({2}) r{3}",
                                      item.Path, item.Kind, item.Revision);
                    Console.WriteLine("C2: {1} -> {2}",
                                      item.Url,
                                      item.CopyFromUrl);
                }
                Console.WriteLine();
            }

            Console.Write("Enter log message: ");
            logMessage = new AprString(Console.ReadLine(), pool);
            tmpFile    = new SvnPath(pool);

            return(SvnError.NoError);
        }
Ejemplo n.º 7
0
        private SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile, AprArray commitItems, IntPtr baton, AprPool pool)
        {
            if (!commitItems.IsNull)
            {
                foreach (SvnClientCommitItem2 item in commitItems)
                {
                    m_log.Debug("[SVNBACKUP]: ... " + Path.GetFileName(item.Path.ToString()) + " (" + item.Kind.ToString() + ") r" + item.Revision.ToString());
                }
            }

            string msg = "Region Backup (" + System.Environment.MachineName + " at " + DateTime.UtcNow + " UTC)";

            m_log.Debug("[SVNBACKUP]: Saved with message: " + msg);

            logMessage = new AprString(msg, pool);
            tmpFile = new SvnPath(pool);

            return (SvnError.NoError);
        }
Ejemplo n.º 8
0
        public void NotifyCallback(IntPtr baton, SvnPath Path,
                                   SvnWcNotify.Action action, Svn.NodeKind kind,
                                   AprString mimeType, SvnWcNotify.State contentState,
                                   SvnWcNotify.State propState, int revNum)
        {
            switch (action)
            {
            case SvnWcNotify.Action.Add:
                if (!mimeType.IsNull && !mimeType.ToString().StartsWith("text/"))
                {
                    Console.WriteLine("A  (bin)  {0}", Path);
                }
                else
                {
                    Console.WriteLine("A         {0}", Path);
                }
                mChanged = true;
                break;

            case SvnWcNotify.Action.BlameRevision:
                break;

            case SvnWcNotify.Action.CommitAdded:
                if (!mimeType.IsNull && !mimeType.ToString().StartsWith("text/"))
                {
                    Console.WriteLine("Adding  (bin)  {0}", Path);
                }
                else
                {
                    Console.WriteLine("Adding         {0}", Path);
                }
                break;

            case SvnWcNotify.Action.CommitDeleted:
                Console.WriteLine("Deleting       {0}", Path);
                break;

            case SvnWcNotify.Action.CommitModified:
                Console.WriteLine("Sending        {0}", Path);
                break;

            case SvnWcNotify.Action.CommitReplaced:
                Console.WriteLine("Replacing      {0}", Path);
                break;

            case SvnWcNotify.Action.Copy:
                break;

            case SvnWcNotify.Action.Delete:
                Console.WriteLine("D         {0}", Path);
                mChanged = true;
                break;

            case SvnWcNotify.Action.FailedRevert:
                Console.WriteLine("Failed to revert '{0}' -- try updating instead.", Path);
                break;

            case SvnWcNotify.Action.PostfixTxdelta:
                if (!mTxDelta)
                {
                    Console.Write("Transmitting file data ");
                    mTxDelta = true;
                }
                Console.Write(".");
                break;

            case SvnWcNotify.Action.Resolved:
                Console.WriteLine("Resolved conflicted state of '{0}'", Path);
                break;

            case SvnWcNotify.Action.Restore:
                Console.WriteLine("Restored '{0}'", Path);
                break;

            case SvnWcNotify.Action.Revert:
                Console.WriteLine("Reverted '{0}'", Path);
                break;

            case SvnWcNotify.Action.Skip:
                if (contentState == SvnWcNotify.State.Missing)
                {
                    Console.WriteLine("Skipped missing target: '{0}'", Path);
                }
                else
                {
                    Console.WriteLine("Skipped '{0}'", Path);
                }
                break;

            case SvnWcNotify.Action.StatusCompleted:
                if (revNum >= 0)
                {
                    Console.WriteLine("Status against revision: {0}", revNum);
                }
                break;

            case SvnWcNotify.Action.StatusExternal:
                Console.WriteLine("\nPerforming status on external item at '{0}'", Path);
                break;

            case SvnWcNotify.Action.UpdateAdd:
                Console.WriteLine("A {0}", Path);
                mChanged = true;
                break;

            case SvnWcNotify.Action.UpdateCompleted:
                if (revNum >= 0)
                {
                    if (mSubCmd.LongName == "export")
                    {
                        Console.WriteLine("Exported {0}revision {1}.",
                                          (mInExternal) ? "external at " : "",
                                          revNum);
                    }
                    else if (mSubCmd.LongName == "checkout")
                    {
                        Console.WriteLine("Checked out {0}revision {1}.",
                                          (mInExternal) ? "external at " : "",
                                          revNum);
                    }
                    else
                    {
                        if (mChanged)
                        {
                            Console.WriteLine("Updated {0}to revision {1}.",
                                              (mInExternal) ? "external at " : "",
                                              revNum);
                        }
                        else
                        {
                            Console.WriteLine("{0}t revision {1}.",
                                              (mInExternal) ? "External a" : "A",
                                              revNum);
                        }
                    }
                }
                else                          /* no revision */
                {
                    if (mSubCmd.LongName == "export")
                    {
                        Console.WriteLine("{0}xport complete.",
                                          (mInExternal) ? "External e" : "E");
                    }
                    else if (mSubCmd.LongName == "checkout")
                    {
                        Console.WriteLine("{0}heckout complete.\n",
                                          (mInExternal) ? "External c" : "C");
                    }
                    else
                    {
                        Console.WriteLine("{0}pdate complete.\n",
                                          (mInExternal) ? "External u" : "U");
                    }
                }
                if (mInExternal)
                {
                    Console.WriteLine();
                }
                mInExternal = false;
                mChanged    = false;
                break;

            case SvnWcNotify.Action.UpdateDelete:
                Console.WriteLine("D {0}", Path);
                mChanged = true;
                break;

            case SvnWcNotify.Action.UpdateExternal:
                Console.WriteLine("\nFetching external item into '{0}'", Path);
                mInExternal = true;
                break;

            case SvnWcNotify.Action.UpdateUpdate:
                string s1 = " ";
                string s2 = " ";
                if (!((kind == Svn.NodeKind.Dir) &&
                      ((propState == SvnWcNotify.State.Inapplicable) ||
                       (propState == SvnWcNotify.State.Unknown) ||
                       (propState == SvnWcNotify.State.Unchanged))))
                {
                    mChanged = true;
                    if (kind == Svn.NodeKind.File)
                    {
                        if (contentState == SvnWcNotify.State.Conflicted)
                        {
                            s1 = "C";
                        }
                        else if (contentState == SvnWcNotify.State.Merged)
                        {
                            s1 = "G";
                        }
                        else if (contentState == SvnWcNotify.State.Changed)
                        {
                            s1 = "U";
                        }
                    }

                    if (propState == SvnWcNotify.State.Conflicted)
                    {
                        s2 = "C";
                    }
                    else if (propState == SvnWcNotify.State.Merged)
                    {
                        s2 = "G";
                    }
                    else if (propState == SvnWcNotify.State.Changed)
                    {
                        s2 = "U";
                    }

                    if (!((contentState == SvnWcNotify.State.Unchanged ||
                           contentState == SvnWcNotify.State.Unknown) &&
                          (propState == SvnWcNotify.State.Unchanged ||
                           propState == SvnWcNotify.State.Unknown)))
                    {
                        Console.WriteLine("{0}{1} {2}", s1, s2, Path);
                    }
                }
                break;
            }
        }
Ejemplo n.º 9
0
 private void HoldStatus(IntPtr baton, SvnPath path, SvnWcStatus2 status)
 {
     this.Status = status;
 }
Ejemplo n.º 10
0
        private void StatusCallback(IntPtr baton, SvnPath path, SvnWcStatus status)
        {
            if (status.IsNull ||
                (oQuiet && status.Entry.IsNull) ||
                ((status.TextStatus == SvnWcStatus.Kind.None) &&
                 (status.ReposTextStatus == SvnWcStatus.Kind.None)))
            {
                return;
            }

            string wrkRevNum = "";
            string ciRevNum  = "";
            string ciAuthor  = "";
            char   oodStatus = '@';

            if (oShowUpdates || oVerbose)
            {
                if (status.Entry.IsNull)
                {
                    wrkRevNum = "";
                }
                else if (status.Entry.Revision < 0)
                {
                    wrkRevNum = " ? ";
                }
                else if (status.Copied)
                {
                    wrkRevNum = "-";
                }
                else
                {
                    wrkRevNum = status.Entry.Revision.ToString();
                }

                if (status.ReposTextStatus != SvnWcStatus.Kind.None ||
                    status.ReposPropStatus != SvnWcStatus.Kind.None)
                {
                    oodStatus = '*';
                }
                else
                {
                    oodStatus = ' ';
                }

                if (oVerbose)
                {
                    if (status.Entry.IsNull)
                    {
                        ciRevNum = "";
                    }
                    else if (status.Entry.CommitRev < 0)
                    {
                        ciRevNum = " ? ";
                    }
                    else
                    {
                        ciRevNum = status.Entry.CommitRev.ToString();
                    }

                    if (status.Entry.IsNull)
                    {
                        ciAuthor = "";
                    }
                    else if (status.Entry.CommitAuthor.IsNull)
                    {
                        ciAuthor = " ? ";
                    }
                    else
                    {
                        ciAuthor = status.Entry.CommitAuthor.ToString();
                    }
                }
            }

            if (oVerbose)
            {
                Console.WriteLine("{0}{1}{2}{3}{4}  {5}   {6,6}   {7,6:X} {8,-12} {9}",
                                  WcStatusChar(status.TextStatus),
                                  WcStatusChar(status.PropStatus),
                                  status.Locked ? 'L' : ' ',
                                  status.Copied ? '+' : ' ',
                                  status.Switched ? 'S' : ' ',
                                  oodStatus,
                                  wrkRevNum,
                                  ciRevNum,
                                  ciAuthor,
                                  path);
            }
            else if (oShowUpdates)
            {
                Console.WriteLine("{0}{1}{2}{3}{4}  {5}   {6,6}   {7}",
                                  WcStatusChar(status.TextStatus),
                                  WcStatusChar(status.PropStatus),
                                  status.Locked ? 'L' : ' ',
                                  status.Copied ? '+' : ' ',
                                  status.Switched ? 'S' : ' ',
                                  oodStatus,
                                  wrkRevNum,
                                  path);
            }
            else
            {
                Console.WriteLine("{0}{1}{2}{3}{4}  {5}",
                                  WcStatusChar(status.TextStatus),
                                  WcStatusChar(status.PropStatus),
                                  status.Locked ? 'L' : ' ',
                                  status.Copied ? '+' : ' ',
                                  status.Switched ? 'S' : ' ',
                                  path);
            }
        }