public WalkPushConnection(IWalkTransport walkTransport, WalkRemoteObjectDatabase w) { var t = (Transport) walkTransport; _local = t.Local; _uri = t.Uri; _dest = w; }
public static bool canHandle(URIish uri) { if (uri == null) throw new ArgumentNullException("uri"); if (!uri.IsRemote) { return false; } string scheme = uri.Scheme; if ("ssh".Equals(scheme)) { return true; } if ("ssh+git".Equals(scheme)) { return true; } if ("git+ssh".Equals(scheme)) { return true; } if (scheme == null && uri.Host != null && uri.Path != null) { return true; } return false; }
public FetchHeadRecord(ObjectId newValue, bool notForMerge, string sourceName, URIish sourceUri) { NewValue = newValue; NotForMerge = notForMerge; SourceName = sourceName; SourceURI = sourceUri; }
public static bool canHandle(URIish uri) { if (uri == null) throw new ArgumentNullException ("uri"); return uri.IsRemote && "sftp".Equals(uri.Scheme); }
public static bool canHandle(URIish uri) { if (uri == null) throw new System.ArgumentNullException("uri"); return "git".Equals(uri.Scheme); }
public static bool canHandle(URIish uri) { if (!uri.IsRemote) { return false; } string scheme = uri.Scheme; if ("ssh".Equals(scheme)) { return true; } if ("ssh+git".Equals(scheme)) { return true; } if ("git+ssh".Equals(scheme)) { return true; } if (scheme == null && uri.Host != null && uri.Path != null) { return true; } return false; }
public SubmoduleEntry(string name, string path, URIish url, UpdateMethod update) { Name = name; Path = path; Url = url; Update = update; }
public static bool canHandle(URIish uri) { if (!uri.IsRemote) { return false; } return S3_SCHEME == uri.Scheme; }
public void testFileProtoWindows() { const string str = "file:///D:/m y"; var u = new URIish(str); Assert.AreEqual("file", u.Scheme); Assert.IsFalse(u.IsRemote); Assert.AreEqual("D:/m y", u.Path); Assert.AreEqual(str, u.ToString()); Assert.AreEqual(u, new URIish(str)); }
public void testUnixFile() { const string str = "/home/m y"; var u = new URIish(str); Assert.IsNull(u.Scheme); Assert.IsFalse(u.IsRemote); Assert.AreEqual(str, u.Path); Assert.AreEqual(str, u.ToString()); Assert.AreEqual(u, new URIish(str)); }
public void testWindowsFile2() { const string str = "D:\\m y"; var u = new URIish(str); Assert.IsNull(u.Scheme); Assert.IsFalse(u.IsRemote); Assert.AreEqual("D:/m y", u.Path); Assert.AreEqual("D:/m y", u.ToString()); Assert.AreEqual(u, new URIish(str)); }
public TransportLocal(Repository local, URIish uri) : base(local, uri) { string dir = FS.resolve(new DirectoryInfo(PWD), uri.Path).FullName; if(Directory.Exists(Path.Combine(dir, Constants.DOT_GIT))) { dir = Path.Combine(dir, Constants.DOT_GIT); } remoteGitDir = new DirectoryInfo(dir); }
public void testGitProtoUnix() { const string str = "git://example.com/home/m y"; var u = new URIish(str); Assert.AreEqual("git", u.Scheme); Assert.IsTrue(u.IsRemote); Assert.AreEqual("example.com", u.Host); Assert.AreEqual("/home/m y", u.Path); Assert.AreEqual(str, u.ToString()); Assert.AreEqual(u, new URIish(str)); }
public static bool canHandle(URIish uri) { if (uri == null) throw new ArgumentNullException("uri"); if (!uri.IsRemote) { return false; } string s = uri.Scheme; return "http".Equals(s) || "https".Equals(s) || "ftp".Equals(s); }
public static bool canHandle(URIish uri) { if (uri == null) throw new ArgumentNullException ("uri"); if (!uri.IsRemote) { return false; } return S3_SCHEME == uri.Scheme; }
public static bool canHandle(URIish uri) { if (uri.Host != null || uri.Port > 0 || uri.User != null || uri.Pass != null || uri.Path == null) { return false; } if ("file".Equals(uri.Scheme) || uri.Scheme == null) { return FS.resolve(new DirectoryInfo(PWD), uri.Path).Exists; } return false; }
public static bool CanHandle(URIish uri) { if (uri == null) throw new ArgumentNullException ("uri"); if (uri.Host != null || uri.Port > 0 || uri.User != null || uri.Pass != null || uri.Path == null) return false; if ("file".Equals(uri.Scheme) || uri.Scheme == null) { FileInfo file = resolve(new DirectoryInfo("."), uri.Path); return file.Name.EndsWith(".bundle"); } return false; }
public void testAddURI() { readConfig(string.Empty); URIish uri = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.AreEqual(0, rc.URIs.Count); Assert.IsTrue(rc.AddURI(uri)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(uri, rc.URIs[0]); Assert.IsFalse(rc.AddURI(new URIish(uri.ToString()))); Assert.AreEqual(1, rc.URIs.Count); }
public TransportHttp(Repository local, URIish uri) : base(local, uri) { try { string uriString = uri.ToString(); if (!uriString.EndsWith("/")) { uriString += "/"; } _baseUrl = new Uri(uriString); _objectsUrl = new Uri(_baseUrl, "objects/"); } catch (UriFormatException e) { throw new NotSupportedException("Invalid URL " + uri, e); } }
public void testRemoveOnlyURI() { readConfig(string.Empty); URIish a = new URIish("/some/dir"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.AreEqual(1, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.IsTrue(rc.RemoveURI(a)); Assert.AreEqual(0, rc.URIs.Count); }
public void testRemoveMiddleURI() { readConfig(string.Empty); URIish a = new URIish("/some/dir"); URIish b = new URIish("/another/dir"); URIish c = new URIish("/more/dirs"); RemoteConfig rc = new RemoteConfig(config, "backup"); Assert.IsTrue(rc.AddURI(a)); Assert.IsTrue(rc.AddURI(b)); Assert.IsTrue(rc.AddURI(c)); Assert.AreEqual(3, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(b, rc.URIs[1]); Assert.AreEqual(c, rc.URIs[2]); Assert.IsTrue(rc.RemoveURI(b)); Assert.AreEqual(2, rc.URIs.Count); Assert.AreSame(a, rc.URIs[0]); Assert.AreSame(c, rc.URIs[1]); }
public TransportGitAnon(Repository local, URIish uri) : base(local, uri) { }
public TransportAmazonS3(Repository local, URIish uri) : base(local, uri) { }
protected SshTransport(Repository local, URIish uri) : base(local, uri) { _sch = SshSessionFactory.Instance; }
/// <summary> /// Support for Transport over HTTP and Git (Anon+SSH) /// </summary> /// <param name="local"></param> /// <param name="remote"></param> /// <returns></returns> public static Transport Open(Repository local, URIish remote) { if (TransportHttp.canHandle(remote)) return new TransportHttp(local, remote); if (TransportGitAnon.canHandle(remote)) return new TransportGitAnon(local, remote); if (TransportGitSsh.canHandle(remote)) return new TransportGitSsh(local, remote); if (TransportSftp.canHandle(remote)) return new TransportSftp(local, remote); throw new NotSupportedException("URI not supported: " + remote); }
private URIish(URIish u) { Scheme = u.Scheme; Path = u.Path; User = u.User; Pass = u.Pass; Port = u.Port; Host = u.Host; }
public void SetAdvertisedRefs(URIish u, IDictionary <string, Ref> ar) { _uri = u; _advertisedRefs = ar; }
public TransportLocal(Repository local, URIish uri) : base(local, uri) { }
private void printPushResult(URIish uri, PushResult result) { shownUri = false; bool everythingUpToDate = true; foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status == RemoteRefUpdate.UpdateStatus.UP_TO_DATE) { if (Verbose) printRefUpdateResult(uri, result, rru); } else { everythingUpToDate = false; } } foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status == RemoteRefUpdate.UpdateStatus.OK) printRefUpdateResult(uri, result, rru); } foreach (RemoteRefUpdate rru in result.RemoteUpdates) { if (rru.Status != RemoteRefUpdate.UpdateStatus.OK && rru.Status != RemoteRefUpdate.UpdateStatus.UP_TO_DATE) printRefUpdateResult(uri, result, rru); } if (everythingUpToDate) OutputStream.WriteLine("Everything up-to-date"); }
protected BasePackConnection(IPackTransport packTransport) { transport = (Transport)packTransport; local = transport.Local; uri = transport.Uri; }
public TransportGitSsh(Repository local, URIish uri) : base(local, uri) { }
public static bool canHandle(URIish uri) { return("git".Equals(uri.Scheme)); }
/// <summary> /// Add a new push-only URI to the end of the list of URIs. /// </summary> /// <param name="toAdd">the new URI to add to this remote.</param> /// <returns>true if the URI was added; false if it already exists.</returns> public bool AddPushURI(URIish toAdd) { if (PushURIs.Contains(toAdd)) return false; PushURIs.Add(toAdd); return true; }
protected Transport(Repository local, URIish uri) { _optionUploadPack = RemoteConfig.DEFAULT_UPLOAD_PACK; _optionReceivePack = RemoteConfig.DEFAULT_RECEIVE_PACK; FetchThin = DEFAULT_FETCH_THIN; PushThin = DEFAULT_PUSH_THIN; _tagopt = TagOpt.NO_TAGS; _fetchSpecs = new List<RefSpec>(); _pushSpecs = new List<RefSpec>(); _local = local; _uri = uri; }
/// <summary> /// Remove a push-only URI from the list of URIs. /// </summary> /// <param name="toRemove">the URI to remove from this remote.</param> /// <returns>true if the URI was added; false if it already exists.</returns> public bool RemovePushURI(URIish toRemove) { return(PushURIs.Remove(toRemove)); }
/// <summary> /// Remove a URI from the list of URIs. /// </summary> /// <param name="toRemove">the URI to remove from this remote.</param> /// <returns>true if the URI was added; false if it already exists.</returns> public bool RemoveURI(URIish toRemove) { return URIs.Remove(toRemove); }
/// <summary> /// Create a new transport to fetch objects from a streamed bundle. /// <para/> /// The stream can be unbuffered (buffering is automatically provided /// internally to smooth out short reads) and unpositionable (the stream is /// Read from only once, sequentially). /// <para/> /// When the FetchConnection or the this instance is closed the supplied /// input stream is also automatically closed. This frees callers from /// needing to keep track of the supplied stream. /// </summary> /// <param name="local">repository the fetched objects will be loaded into.</param> /// <param name="uri"> /// symbolic name of the source of the stream. The URI can /// reference a non-existent resource. It is used only for /// exception reporting. /// </param> /// <param name="inputStream">the stream to Read the bundle from.</param> public TransportBundleStream(Repository local, URIish uri, Stream inputStream) : base(local, uri) { _inputStream = inputStream; }
/// <summary> /// Remove a push-only URI from the list of URIs. /// </summary> /// <param name="toRemove">the URI to remove from this remote.</param> /// <returns>true if the URI was added; false if it already exists.</returns> public bool RemovePushURI(URIish toRemove) { return PushURIs.Remove(toRemove); }
public FetchHeadRecord(ObjectId newValue, bool notForMerge, string sourceName, URIish sourceUri) { NewValue = newValue; NotForMerge = notForMerge; SourceName = sourceName; SourceURI = sourceUri; }
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; } }
public TransportBundleFile(Repository local, URIish uri) : base(local, uri) { _bundle = PathUtil.CombineFilePath(new DirectoryInfo("."), uri.Path); }