public WalkFetchConnection(IWalkTransport t, WalkRemoteObjectDatabase w)
        {
            var wt = (Transport)t;

            _local    = wt.Local;
            _objCheck = wt.CheckFetchedObjects ? new ObjectChecker() : null;

            _remotes = new List <WalkRemoteObjectDatabase> {
                w
            };

            _unfetchedPacks  = new LinkedList <RemotePack>();
            _packsConsidered = new List <string>();

            _noPacksYet = new LinkedList <WalkRemoteObjectDatabase>();
            _noPacksYet.AddLast(w);

            _noAlternatesYet = new LinkedList <WalkRemoteObjectDatabase>();
            _noAlternatesYet.AddLast(w);

            _fetchErrors = new Dictionary <ObjectId, List <Exception> >();
            _packLocks   = new List <PackLock>(4);

            _revWalk = new RevWalk.RevWalk(_local);
            _revWalk.setRetainBody(false);
            _treeWalk = new TreeWalk.TreeWalk(_local);

            COMPLETE      = _revWalk.newFlag("COMPLETE");
            IN_WORK_QUEUE = _revWalk.newFlag("IN_WORK_QUEUE");
            LOCALLY_SEEN  = _revWalk.newFlag("LOCALLY_SEEN");

            _localCommitQueue = new DateRevQueue();
            _workQueue        = new LinkedList <ObjectId>();
        }
예제 #2
0
        public UploadPack(Repository copyFrom)
        {
            db = copyFrom;
            walk = new RevWalk.RevWalk(db);

            ADVERTISED = walk.newFlag("ADVERTISED");
            WANT = walk.newFlag("WANT");
            PEER_HAS = walk.newFlag("PEER_HAS");
            COMMON = walk.newFlag("COMMON");
            walk.carry(PEER_HAS);

            SAVE = new RevFlagSet();
            SAVE.Add(ADVERTISED);
            SAVE.Add(WANT);
            SAVE.Add(PEER_HAS);
        }
예제 #3
0
        ///	<summary>
        /// Create a new pack upload for an open repository.
        /// </summary>
        /// <param name="copyFrom">the source repository.</param>
        public UploadPack(Repository copyFrom)
        {
            _db   = copyFrom;
            _walk = new RevWalk.RevWalk(_db);
            _walk.setRetainBody(false);

            ADVERTISED = _walk.newFlag("ADVERTISED");
            WANT       = _walk.newFlag("WANT");
            PEER_HAS   = _walk.newFlag("PEER_HAS");
            COMMON     = _walk.newFlag("COMMON");
            _walk.carry(PEER_HAS);

            SAVE = new RevFlagSet {
                ADVERTISED, WANT, PEER_HAS
            };
            _refFilter = RefFilterContants.DEFAULT;
        }
        public BasePackFetchConnection(IPackTransport packTransport) : base(packTransport)
        {
            RepositoryConfig cfg = local.Config;
            includeTags = transport.TagOpt != TagOpt.NO_TAGS;
            thinPack = transport.FetchThin;
            allowOfsDelta = cfg.GetBoolean("repack", "usedeltabaseoffset", true);

            walk = new RevWalk.RevWalk(local);
            reachableCommits = new RevCommitList<RevCommit>();
            REACHABLE = walk.newFlag("REACHABLE");
            COMMON = walk.newFlag("COMMON");
            ADVERTISED = walk.newFlag("ADVERTISED");

            walk.carry(COMMON);
            walk.carry(REACHABLE);
            walk.carry(ADVERTISED);
        }
예제 #5
0
        public BasePackFetchConnection(IPackTransport packTransport)
            : base(packTransport)
        {
            RepositoryConfig cfg = local.Config;

            _includeTags   = transport.TagOpt != TagOpt.NO_TAGS;
            _thinPack      = transport.FetchThin;
            _allowOfsDelta = cfg.getBoolean("repack", "usedeltabaseoffset", true);

            _walk             = new RevWalk.RevWalk(local);
            _reachableCommits = new RevCommitList <RevCommit>();
            REACHABLE         = _walk.newFlag("REACHABLE");
            COMMON            = _walk.newFlag("COMMON");
            ADVERTISED        = _walk.newFlag("ADVERTISED");

            _walk.carry(COMMON);
            _walk.carry(REACHABLE);
            _walk.carry(ADVERTISED);
        }
        public BasePackFetchConnection(IPackTransport packTransport)
            : base(packTransport)
        {
            FetchConfig cfg = local.Config.get(FetchConfig.KEY);

            _includeTags   = transport.TagOpt != TagOpt.NO_TAGS;
            _thinPack      = transport.FetchThin;
            _allowOfsDelta = cfg.AllowOfsDelta;

            _walk             = new RevWalk.RevWalk(local);
            _reachableCommits = new RevCommitList <RevCommit>();
            REACHABLE         = _walk.newFlag("REACHABLE");
            COMMON            = _walk.newFlag("COMMON");
            ADVERTISED        = _walk.newFlag("ADVERTISED");

            _walk.carry(COMMON);
            _walk.carry(REACHABLE);
            _walk.carry(ADVERTISED);
        }
예제 #7
0
        ///	<summary>
        /// Create a new pack upload for an open repository.
        /// </summary>
        /// <param name="copyFrom">the source repository.</param>
        public UploadPack(Repository copyFrom)
        {
            _options     = new List <string>();
            _wantAll     = new List <RevObject>();
            _wantCommits = new List <RevCommit>();
            _commonBase  = new List <RevObject>();

            _db   = copyFrom;
            _walk = new RevWalk.RevWalk(_db);
            _walk.setRetainBody(false);

            ADVERTISED = _walk.newFlag("ADVERTISED");
            WANT       = _walk.newFlag("WANT");
            PEER_HAS   = _walk.newFlag("PEER_HAS");
            COMMON     = _walk.newFlag("COMMON");
            _walk.carry(PEER_HAS);

            SAVE = new RevFlagSet {
                ADVERTISED, WANT, PEER_HAS
            };
        }
예제 #8
0
        private void verifyPrerequisites()
        {
            if (prereqs.isEmpty())
                return;

            using(RevWalk.RevWalk rw = new RevWalk.RevWalk(transport.Local))
            {
                RevFlag PREREQ = rw.newFlag("PREREQ");
                RevFlag SEEN = rw.newFlag("SEEN");

                List<ObjectId> missing = new List<ObjectId>();
                List<RevObject> commits = new List<RevObject>();
                foreach (ObjectId p in prereqs)
                {
                    try
                    {
                        RevCommit c = rw.parseCommit(p);
                        if (!c.has(PREREQ))
                        {
                            c.add(PREREQ);
                            commits.Add(c);
                        }
                    }
                    catch (MissingObjectException)
                    {
                        missing.Add(p);
                    }
                    catch (IOException err)
                    {
                        throw new TransportException(transport.Uri, "Cannot Read commit " + p.Name, err);
                    }
                }

                if (!missing.isEmpty())
                    throw new MissingBundlePrerequisiteException(transport.Uri, missing);

                foreach (Ref r in transport.Local.getAllRefs().Values)
                {
                    try
                    {
                        rw.markStart(rw.parseCommit(r.ObjectId));
                    }
                    catch (IOException)
                    {
                    }
                }

                int remaining = commits.Count;
                try
                {
                    RevCommit c;
                    while ((c = rw.next()) != null)
                    {
                        if (c.has(PREREQ))
                        {
                            c.add(SEEN);
                            if (--remaining == 0)
                                break;
                        }
                    }
                }
                catch (IOException err)
                {
                    throw new TransportException(transport.Uri, "Cannot Read object", err);
                }

                if (remaining > 0)
                {
                    foreach (RevObject o in commits)
                    {
                        if (!o.has(SEEN))
                            missing.Add(o);
                    }
                    throw new MissingBundlePrerequisiteException(transport.Uri, missing);
                }
            }
        }
예제 #9
0
        public WalkFetchConnection(IWalkTransport t, WalkRemoteObjectDatabase w)
        {
            _idBuffer = new MutableObjectId();
            _objectDigest = Constants.newMessageDigest();

            var wt = (Transport)t;
            _local = wt.Local;
            _objCheck = wt.CheckFetchedObjects ? new ObjectChecker() : null;

            _remotes = new List<WalkRemoteObjectDatabase> { w };

            _unfetchedPacks = new LinkedList<RemotePack>();
            _packsConsidered = new List<string>();

            _noPacksYet = new LinkedList<WalkRemoteObjectDatabase>();
            _noPacksYet.AddFirst(w);

            _noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>();
            _noAlternatesYet.AddFirst(w);

            _fetchErrors = new Dictionary<ObjectId, List<Exception>>();
            _packLocks = new List<PackLock>(4);

            _revWalk = new RevWalk.RevWalk(_local);
            _treeWalk = new TreeWalk.TreeWalk(_local);

            COMPLETE = _revWalk.newFlag("COMPLETE");
            IN_WORK_QUEUE = _revWalk.newFlag("IN_WORK_QUEUE");
            LOCALLY_SEEN = _revWalk.newFlag("LOCALLY_SEEN");

            _localCommitQueue = new DateRevQueue();
            _workQueue = new LinkedList<ObjectId>();
        }
        private void verifyPrerequisites()
        {
            if (_prereqs.isEmpty())
                return;

            using (var rw = new RevWalk.RevWalk(_transport.Local))
            {
                RevFlag PREREQ = rw.newFlag("PREREQ");
                RevFlag SEEN = rw.newFlag("SEEN");

                IDictionary<ObjectId, string> missing = new Dictionary<ObjectId, string>();
                var commits = new List<RevObject>();
                foreach (KeyValuePair<ObjectId, string> e in _prereqs)
                {
                    ObjectId p = e.Key;
                    try
                    {
                        RevCommit c = rw.parseCommit(p);
                        if (!c.has(PREREQ))
                        {
                            c.add(PREREQ);
                            commits.Add(c);
                        }
                    }
                    catch (MissingObjectException)
                    {
                        missing.put(p, e.Value);
                    }
                    catch (IOException err)
                    {
                        throw new TransportException(_transport.Uri, "Cannot Read commit " + p.Name, err);
                    }
                }

                if (!missing.isEmpty())
                    throw new MissingBundlePrerequisiteException(_transport.Uri, missing);

                foreach (Ref r in _transport.Local.getAllRefs().Values)
                {
                    try
                    {
                        rw.markStart(rw.parseCommit(r.ObjectId));
                    }
                    catch (IOException)
                    {
                        // If we cannot read the value of the ref skip it.
                    }
                }

                int remaining = commits.Count;
                try
                {
                    RevCommit c;
                    while ((c = rw.next()) != null)
                    {
                        if (c.has(PREREQ))
                        {
                            c.add(SEEN);
                            if (--remaining == 0)
                                break;
                        }
                    }
                }
                catch (IOException err)
                {
                    throw new TransportException(_transport.Uri, "Cannot Read object", err);
                }

                if (remaining > 0)
                {
                    foreach (RevObject o in commits)
                    {
                        if (!o.has(SEEN))
                            missing.put(o, _prereqs.get(o));
                    }
                    throw new MissingBundlePrerequisiteException(_transport.Uri, missing);
                }
            }
        }
예제 #11
0
        ///	<summary>
        /// Create a new pack upload for an open repository.
        /// </summary>
        /// <param name="copyFrom">the source repository.</param>
        public UploadPack(Repository copyFrom)
        {
            _db = copyFrom;
            _walk = new RevWalk.RevWalk(_db);
            _walk.setRetainBody(false);

            ADVERTISED = _walk.newFlag("ADVERTISED");
            WANT = _walk.newFlag("WANT");
            PEER_HAS = _walk.newFlag("PEER_HAS");
            COMMON = _walk.newFlag("COMMON");
            _walk.carry(PEER_HAS);

            SAVE = new RevFlagSet { ADVERTISED, WANT, PEER_HAS };
            _refFilter = RefFilterContants.DEFAULT;
        }
예제 #12
0
        ///	<summary>
        /// Create a new pack upload for an open repository.
        /// </summary>
        /// <param name="copyFrom">the source repository.</param>
        public UploadPack(Repository copyFrom)
        {
            _options = new List<string>();
            _wantAll = new List<RevObject>();
            _wantCommits = new List<RevCommit>();
            _commonBase = new List<RevObject>();

            _db = copyFrom;
            _walk = new RevWalk.RevWalk(_db);
            _walk.setRetainBody(false);

            ADVERTISED = _walk.newFlag("ADVERTISED");
            WANT = _walk.newFlag("WANT");
            PEER_HAS = _walk.newFlag("PEER_HAS");
            COMMON = _walk.newFlag("COMMON");
            _walk.carry(PEER_HAS);

            SAVE = new RevFlagSet { ADVERTISED, WANT, PEER_HAS };
        }
        private void verifyPrerequisites()
        {
            if (_prereqs.isEmpty())
            {
                return;
            }

            using (var rw = new RevWalk.RevWalk(_transport.Local))
            {
                RevFlag PREREQ = rw.newFlag("PREREQ");
                RevFlag SEEN   = rw.newFlag("SEEN");

                IDictionary <ObjectId, string> missing = new Dictionary <ObjectId, string>();
                var commits = new List <RevObject>();
                foreach (KeyValuePair <ObjectId, string> e in _prereqs)
                {
                    ObjectId p = e.Key;
                    try
                    {
                        RevCommit c = rw.parseCommit(p);
                        if (!c.has(PREREQ))
                        {
                            c.add(PREREQ);
                            commits.Add(c);
                        }
                    }
                    catch (MissingObjectException)
                    {
                        missing.put(p, e.Value);
                    }
                    catch (IOException err)
                    {
                        throw new TransportException(_transport.Uri, "Cannot Read commit " + p.Name, err);
                    }
                }

                if (!missing.isEmpty())
                {
                    throw new MissingBundlePrerequisiteException(_transport.Uri, missing);
                }

                foreach (Ref r in _transport.Local.getAllRefs().Values)
                {
                    try
                    {
                        rw.markStart(rw.parseCommit(r.ObjectId));
                    }
                    catch (IOException)
                    {
                        // If we cannot read the value of the ref skip it.
                    }
                }

                int remaining = commits.Count;
                try
                {
                    RevCommit c;
                    while ((c = rw.next()) != null)
                    {
                        if (c.has(PREREQ))
                        {
                            c.add(SEEN);
                            if (--remaining == 0)
                            {
                                break;
                            }
                        }
                    }
                }
                catch (IOException err)
                {
                    throw new TransportException(_transport.Uri, "Cannot Read object", err);
                }

                if (remaining > 0)
                {
                    foreach (RevObject o in commits)
                    {
                        if (!o.has(SEEN))
                        {
                            missing.put(o, _prereqs.get(o));
                        }
                    }
                    throw new MissingBundlePrerequisiteException(_transport.Uri, missing);
                }
            }
        }
예제 #14
0
        private void verifyPrerequisites()
        {
            if (prereqs.isEmpty())
            {
                return;
            }

            using (RevWalk.RevWalk rw = new RevWalk.RevWalk(transport.Local))
            {
                RevFlag PREREQ = rw.newFlag("PREREQ");
                RevFlag SEEN   = rw.newFlag("SEEN");

                List <ObjectId>  missing = new List <ObjectId>();
                List <RevObject> commits = new List <RevObject>();
                foreach (ObjectId p in prereqs)
                {
                    try
                    {
                        RevCommit c = rw.parseCommit(p);
                        if (!c.has(PREREQ))
                        {
                            c.add(PREREQ);
                            commits.Add(c);
                        }
                    }
                    catch (MissingObjectException)
                    {
                        missing.Add(p);
                    }
                    catch (IOException err)
                    {
                        throw new TransportException(transport.Uri, "Cannot Read commit " + p.Name, err);
                    }
                }

                if (!missing.isEmpty())
                {
                    throw new MissingBundlePrerequisiteException(transport.Uri, missing);
                }

                foreach (Ref r in transport.Local.getAllRefs().Values)
                {
                    try
                    {
                        rw.markStart(rw.parseCommit(r.ObjectId));
                    }
                    catch (IOException)
                    {
                    }
                }

                int remaining = commits.Count;
                try
                {
                    RevCommit c;
                    while ((c = rw.next()) != null)
                    {
                        if (c.has(PREREQ))
                        {
                            c.add(SEEN);
                            if (--remaining == 0)
                            {
                                break;
                            }
                        }
                    }
                }
                catch (IOException err)
                {
                    throw new TransportException(transport.Uri, "Cannot Read object", err);
                }

                if (remaining > 0)
                {
                    foreach (RevObject o in commits)
                    {
                        if (!o.has(SEEN))
                        {
                            missing.Add(o);
                        }
                    }
                    throw new MissingBundlePrerequisiteException(transport.Uri, missing);
                }
            }
        }