Beispiel #1
0
        /// <exception cref="NGit.Errors.TransportException"></exception>
        public override FetchConnection OpenFetch()
        {
            TransportSftp.SftpObjectDB c = new TransportSftp.SftpObjectDB(this, uri.GetPath()
                                                                          );
            WalkFetchConnection r = new WalkFetchConnection(this, c);

            r.Available(c.ReadAdvertisedRefs());
            return(r);
        }
Beispiel #2
0
        /// <exception cref="NGit.Errors.TransportException"></exception>
        public override FetchConnection OpenFetch()
        {
            TransportAmazonS3.DatabaseS3 c = new TransportAmazonS3.DatabaseS3(this, bucket, keyPrefix
                                                                              + "/objects");
            WalkFetchConnection r = new WalkFetchConnection(this, c);

            r.Available(c.ReadAdvertisedRefs());
            return(r);
        }
Beispiel #3
0
            internal RemotePack(WalkFetchConnection _enclosing, WalkRemoteObjectDatabase c, string
                                pn)
            {
                this._enclosing = _enclosing;
                this.connection = c;
                this.packName   = pn;
                this.idxName    = Sharpen.Runtime.Substring(this.packName, 0, this.packName.Length -
                                                            5) + ".idx";
                string tn = this.idxName;

                if (tn.StartsWith("pack-"))
                {
                    tn = Sharpen.Runtime.Substring(tn, 5);
                }
                if (tn.EndsWith(".idx"))
                {
                    tn = Sharpen.Runtime.Substring(tn, 0, tn.Length - 4);
                }
                if (this._enclosing.local.ObjectDatabase is ObjectDirectory)
                {
                    this.tmpIdx = new FilePath(((ObjectDirectory)this._enclosing.local.ObjectDatabase
                                                ).GetDirectory(), "walk-" + tn + ".walkidx");
                }
            }
			internal RemotePack(WalkFetchConnection _enclosing, WalkRemoteObjectDatabase c, string
				 pn)
			{
				this._enclosing = _enclosing;
				this.connection = c;
				this.packName = pn;
				this.idxName = Sharpen.Runtime.Substring(this.packName, 0, this.packName.Length -
					 5) + ".idx";
				string tn = this.idxName;
				if (tn.StartsWith("pack-"))
				{
					tn = Sharpen.Runtime.Substring(tn, 5);
				}
				if (tn.EndsWith(".idx"))
				{
					tn = Sharpen.Runtime.Substring(tn, 0, tn.Length - 4);
				}
				if (this._enclosing.local.ObjectDatabase is ObjectDirectory)
				{
					this.tmpIdx = new FilePath(((ObjectDirectory)this._enclosing.local.ObjectDatabase
						).GetDirectory(), "walk-" + tn + ".walkidx");
				}
			}
		/// <exception cref="NGit.Errors.TransportException"></exception>
		public override FetchConnection OpenFetch()
		{
			TransportAmazonS3.DatabaseS3 c = new TransportAmazonS3.DatabaseS3(this, bucket, keyPrefix
				 + "/objects");
			WalkFetchConnection r = new WalkFetchConnection(this, c);
			r.Available(c.ReadAdvertisedRefs());
			return r;
		}
Beispiel #6
0
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="NGit.Errors.PackProtocolException"></exception>
        private FetchConnection NewDumbConnection(InputStream @in)
        {
            TransportHttp.HttpObjectDB d  = new TransportHttp.HttpObjectDB(this, objectsUrl);
            BufferedReader             br = ToBufferedReader(@in);
            IDictionary <string, Ref>  refs;

            try
            {
                refs = d.ReadAdvertisedImpl(br);
            }
            finally
            {
                br.Close();
            }
            if (!refs.ContainsKey(Constants.HEAD))
            {
                // If HEAD was not published in the info/refs file (it usually
                // is not there) download HEAD by itself as a loose file and do
                // the resolution by hand.
                //
                HttpURLConnection conn = HttpOpen(new Uri(baseUrl, Constants.HEAD));
                int status             = HttpSupport.Response(conn);
                switch (status)
                {
                case HttpURLConnection.HTTP_OK:
                {
                    br = ToBufferedReader(OpenInputStream(conn));
                    try
                    {
                        string line = br.ReadLine();
                        if (line != null && line.StartsWith(RefDirectory.SYMREF))
                        {
                            string target = Sharpen.Runtime.Substring(line, RefDirectory.SYMREF.Length);
                            Ref    r      = refs.Get(target);
                            if (r == null)
                            {
                                r = new ObjectIdRef.Unpeeled(RefStorage.NEW, target, null);
                            }
                            r = new SymbolicRef(Constants.HEAD, r);
                            refs.Put(r.GetName(), r);
                        }
                        else
                        {
                            if (line != null && ObjectId.IsId(line))
                            {
                                Ref r = new ObjectIdRef.Unpeeled(RefStorage.NETWORK, Constants.HEAD, ObjectId.FromString
                                                                     (line));
                                refs.Put(r.GetName(), r);
                            }
                        }
                    }
                    finally
                    {
                        br.Close();
                    }
                    break;
                }

                case HttpURLConnection.HTTP_NOT_FOUND:
                {
                    break;
                }

                default:
                {
                    throw new TransportException(uri, MessageFormat.Format(JGitText.Get().cannotReadHEAD
                                                                           , status, conn.GetResponseMessage()));
                }
                }
            }
            WalkFetchConnection wfc = new WalkFetchConnection(this, d);

            wfc.Available(refs);
            return(wfc);
        }