public void Duplicate() { AprPool p = AprPool.Create(); Assert.IsFalse(p.IsNull, "#A01"); AprString s = new AprString(); Assert.IsTrue(s.IsNull, "#A02"); s = AprString.Duplicate(p, "This is a test of string duplication"); Assert.IsFalse(s.IsNull, "#A03"); Assert.AreEqual("This is a test of string duplication", s.ToString(), "#A04"); AprString s2 = AprString.Duplicate(p, s); Assert.IsFalse(s2.IsNull, "#A05"); Assert.AreEqual("This is a test of string duplication", s2.ToString(), "#A06"); s2 = AprString.Duplicate(p, s, 14); Assert.IsFalse(s2.IsNull, "#A07"); Assert.AreEqual("This is a test", s2.ToString(), "#A08"); s = AprString.Duplicate(p, "This is a test of string duplication", 14); Assert.IsFalse(s.IsNull, "#A09"); Assert.AreEqual("This is a test", s.ToString(), "#A10"); p.Destroy(); Assert.IsTrue(p.IsNull, "#A11"); }
public SvnError SimpleAuth(out SvnAuthCredSimple cred, IntPtr baton, AprString realm, AprString username, bool maySave, AprPool pool) { Console.WriteLine("Simple Authentication"); Console.WriteLine("---------------------"); Console.WriteLine("Realm: {0}", realm); Console.WriteLine(""); bool valid = false; string line = ""; while (!valid) { if (!username.IsNull) { Console.Write("Enter Username ({0}): ", username); } else { Console.Write("Enter Username: "******"Enter Password: "); cred.Password = new AprString(Console.ReadLine(), pool); cred.MaySave = maySave; return(SvnError.NoError); }
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; } }