Ejemplo n.º 1
0
 /// <summary>Constructs a MissingBundlePrerequisiteException for a set of objects.</summary>
 /// <remarks>Constructs a MissingBundlePrerequisiteException for a set of objects.</remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="missingCommits">
 /// the Map of the base/common object(s) we don't have. Keys are
 /// ids of the missing objects and values are short descriptions.
 /// </param>
 public MissingBundlePrerequisiteException(URIish uri, IDictionary <ObjectId, string
                                                                    > missingCommits) : base(uri, Format(missingCommits))
 {
 }
Ejemplo n.º 2
0
        public void testGetValidWithSlashDotGitHumanishName()
        {
            string humanishName = new URIish("/abc.git").getHumanishName();

            Assert.AreEqual("abc", humanishName);
        }
Ejemplo n.º 3
0
        public void testGetValidWithSlashesDotGitSlashHumanishName()
        {
            string humanishName = new URIish("/a/b/c.git/").getHumanishName();

            Assert.AreEqual("c", humanishName);
        }
Ejemplo n.º 4
0
        public void testGetValidSlashHumanishName()
        {
            string humanishName = new URIish(GIT_SCHEME + "abc/").getHumanishName();

            Assert.AreEqual("abc", humanishName);
        }
Ejemplo n.º 5
0
        public void testGetSlashesValidSlashHumanishName()
        {
            string humanishName = new URIish("/a/b/c/").getHumanishName();

            Assert.AreEqual("c", humanishName);
        }
Ejemplo n.º 6
0
        private void printRefUpdateResult(URIish uri, OperationResult result, RemoteRefUpdate rru)
        {
            if (!shownUri)
            {
                shownUri = true;
                OutputStream.WriteLine("To " + uri);
            }

            string remoteName = rru.RemoteName;
            string srcRef     = rru.IsDelete ? null : rru.SourceRef;

            switch (rru.Status)
            {
            case RemoteRefUpdate.UpdateStatus.OK:
            {
                if (rru.IsDelete)
                {
                    printUpdateLine('-', "[deleted]", null, remoteName, null);
                }
                else
                {
                    GitSharp.Core.Ref oldRef = result.GetAdvertisedRef(remoteName);
                    if (oldRef == null)
                    {
                        string summary = remoteName.StartsWith(Constants.R_TAGS) ? "[new tag]" : "[new branch]";
                        printUpdateLine('*', summary, srcRef, remoteName, null);
                    }
                    else
                    {
                        bool   fastForward = rru.FastForward;
                        char   flag        = fastForward ? ' ' : '+';
                        string summary     = oldRef.ObjectId.Abbreviate(Repository._internal_repo).name() +
                                             (fastForward ? ".." : "...") +
                                             rru.NewObjectId.Abbreviate(Repository._internal_repo).name();
                        string message = fastForward ? null : "forced update";
                        printUpdateLine(flag, summary, srcRef, remoteName, message);
                    }
                }
                break;
            }

            case RemoteRefUpdate.UpdateStatus.NON_EXISTING:
                printUpdateLine('X', "[no match]", null, remoteName, null);
                break;

            case RemoteRefUpdate.UpdateStatus.REJECTED_NODELETE:
                printUpdateLine('!', "[rejected]", null, remoteName, "remote side does not support deleting refs");
                break;

            case RemoteRefUpdate.UpdateStatus.REJECTED_NONFASTFORWARD:
                printUpdateLine('!', "[rejected]", srcRef, remoteName, "non-fast forward");
                break;

            case RemoteRefUpdate.UpdateStatus.REJECTED_REMOTE_CHANGED:
            {
                string message = "remote ref object changed - is not expected one " +
                                 rru.ExpectedOldObjectId.Abbreviate(Repository._internal_repo).name();
                printUpdateLine('!', "[rejected]", srcRef, remoteName, message);
                break;
            }

            case RemoteRefUpdate.UpdateStatus.REJECTED_OTHER_REASON:
                printUpdateLine('!', "[rejected]", srcRef, remoteName, rru.Message);
                break;

            case RemoteRefUpdate.UpdateStatus.UP_TO_DATE:
                if (Verbose)
                {
                    printUpdateLine('=', "[up to date]", srcRef, remoteName, null);
                }
                break;

            case RemoteRefUpdate.UpdateStatus.NOT_ATTEMPTED:
            case RemoteRefUpdate.UpdateStatus.AWAITING_REPORT:
                printUpdateLine('?', "[unexpected push-process behavior]", srcRef, remoteName, rru.Message);
                break;
            }
        }
Ejemplo n.º 7
0
 public NoRemoteRepositoryException(URIish uri, string s, Exception inner)
     : base(uri, s, inner)
 {
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructs an TransportException with the specified detail message
 /// prefixed with provided URI.
 /// </summary>
 /// <remarks>
 /// Constructs an TransportException with the specified detail message
 /// prefixed with provided URI.
 /// </remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="s">message</param>
 /// <param name="cause">root cause exception</param>
 public TransportException(URIish uri, string s, Exception cause) : this(uri.SetPass
                                                                             (null) + ": " + s, cause)
 {
 }
Ejemplo n.º 9
0
 public PackProtocolException(URIish uri, string s)
     : base(uri + ": " + s)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructs an UnsupportedCredentialItem with the specified detail message
 /// prefixed with provided URI.
 /// </summary>
 /// <remarks>
 /// Constructs an UnsupportedCredentialItem with the specified detail message
 /// prefixed with provided URI.
 /// </remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="s">message</param>
 public UnsupportedCredentialItem(URIish uri, string s) : base(uri.SetPass(null) +
                                                               ": " + s)
 {
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructs an TransportException with the specified detail message
 /// prefixed with provided URI.
 /// </summary>
 /// <remarks>
 /// Constructs an TransportException with the specified detail message
 /// prefixed with provided URI.
 /// </remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="s">message</param>
 public TransportException(URIish uri, string s) : base(uri.SetPass(null) + ": " +
                                                        s)
 {
 }
Ejemplo n.º 12
0
 public MockTransport(Core.Repository local, URIish uri, List <Core.Ref> advertisedRefs)
     : base(local, uri)
 {
     advertised = advertisedRefs;
 }
Ejemplo n.º 13
0
		MockTransport(Repository local, URIish uri) {
			super(local, uri);
		}
Ejemplo n.º 14
0
 /// <summary>
 /// Create a new transport instance.
 /// </summary>
 /// <param name="local">
 /// the repository this instance will fetch into, or push out of.
 /// This must be the repository passed to <see cref="Transport.open(Repository, URIish)"/>
 /// </param>
 /// <param name="uri">
 /// The URI used to access the remote repository. This must be the
 /// URI passed to <see cref="Transport.open(Repository, URIish)"/>.
 /// </param>
 protected HttpTransport(Repository local, URIish uri)
     : base(local, uri)
 {
 }
Ejemplo n.º 15
0
 public override void Reset(URIish uri)
 {
     HasReset = true;
 }
Ejemplo n.º 16
0
 public PackProtocolException(URIish uri, string s, Exception cause)
     : base(uri + ": " + s, cause)
 {
 }
Ejemplo n.º 17
0
        public CredentialsDialog(URIish uri, IEnumerable <CredentialItem> credentials)
        {
            this.Build();

            labelTop.Text = string.Format(labelTop.Text, uri.ToString());

            Gtk.Table table = new Gtk.Table(0, 0, false);
            table.ColumnSpacing = 6;
            vbox.PackStart(table, true, true, 0);

            uint   r           = 0;
            Widget firstEditor = null;

            foreach (CredentialItem c in credentials)
            {
                Label lab = new Label(c.GetPromptText() + ":");
                lab.Xalign = 0;
                table.Attach(lab, 0, 1, r, r + 1);
                Table.TableChild tc = (Table.TableChild)table [lab];
                tc.XOptions = AttachOptions.Shrink;

                Widget editor = null;

                if (c is CredentialItem.YesNoType)
                {
                    CredentialItem.YesNoType cred = (CredentialItem.YesNoType)c;
                    if (credentials.Count(i => i is CredentialItem.YesNoType) == 1)
                    {
                        singleYesNoCred = cred;
                        buttonOk.Hide();
                        buttonYes.Show();
                        buttonNo.Show();
                        // Remove the last colon
                        lab.Text = lab.Text.Substring(0, lab.Text.Length - 1);
                    }
                    else
                    {
                        CheckButton btn = new CheckButton();
                        editor       = btn;
                        btn.Toggled += delegate {
                            cred.SetValue(btn.Active);
                        };
                    }
                }
                else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType)
                {
                    CredentialItem cred = c;
                    Entry          e    = new Entry();
                    editor             = e;
                    e.ActivatesDefault = true;
                    if (cred.IsValueSecure())
                    {
                        e.Visibility = false;
                    }
                    e.Changed += delegate {
                        if (cred is CredentialItem.StringType)
                        {
                            ((CredentialItem.StringType)cred).SetValue(e.Text);
                        }
                        else
                        {
                            ((CredentialItem.CharArrayType)cred).SetValue(e.Text.ToCharArray());
                        }
                    };

                    if (c is CredentialItem.Username)
                    {
                        e.Text = uri.GetUser() ?? "";
                    }
                }
                if (editor != null)
                {
                    table.Attach(editor, 1, 2, r, r + 1);
                    tc          = (Table.TableChild)table [lab];
                    tc.XOptions = AttachOptions.Fill;
                    if (firstEditor == null)
                    {
                        firstEditor = editor;
                    }
                }

                r++;
            }
            table.ShowAll();
            Focus   = firstEditor;
            Default = buttonOk;
        }
 /// <summary>Constructs an exception indicating a repository does not exist.</summary>
 /// <remarks>Constructs an exception indicating a repository does not exist.</remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="s">message</param>
 public NoRemoteRepositoryException(URIish uri, string s) : base(uri, s)
 {
 }
Ejemplo n.º 19
0
 /**
  * Create a new transport instance.
  *
  * @param local
  *            the repository this instance will fetch into, or push out of.
  *            This must be the repository passed to
  *            {@link #open(Repository, URIish)}.
  * @param uri
  *            the URI used to access the remote repository. This must be the
  *            URI passed to {@link #open(Repository, URIish)}.
  */
 protected HttpTransport(Repository local, URIish uri)
     : base(local, uri)
 {
     
 }
Ejemplo n.º 20
0
 /// <summary>Constructs a RemoteRepositoryException for a message.</summary>
 /// <remarks>Constructs a RemoteRepositoryException for a message.</remarks>
 /// <param name="uri">URI used for transport</param>
 /// <param name="message">
 /// message, exactly as supplied by the remote repository. May
 /// contain LFs (newlines) if the remote formatted it that way.
 /// </param>
 public RemoteRepositoryException(URIish uri, string message) : base(uri, message)
 {
 }