Пример #1
0
 /**
  * Add a commit if it does not have a flag set yet, then set the flag.
  * <p>
  * This method permits the application to test if the commit has the given
  * flag; if it does not already have the flag than the commit is added to
  * the queue and the flag is set. This later will prevent the commit from
  * being added twice.
  *
  * @param c
  *            commit to add.
  * @param queueControl
  *            flag that controls admission to the queue.
  */
 public void add(RevCommit c, RevFlag queueControl)
 {
     if (!c.has(queueControl))
     {
         c.add(queueControl);
         add(c);
     }
 }
Пример #2
0
        public RefAdvertiser(PacketLineOut o, RevWalk.RevWalk protoWalk, RevFlag advertisedFlag)
        {
            _tmpLine = new StringBuilder(100);
            _tmpId = new char[2 * Constants.OBJECT_ID_LENGTH];
            _capabilities = new List<string>();
            _first = true;

            _pckOut = o;
            _walk = protoWalk;
            ADVERTISED = advertisedFlag;
        }
Пример #3
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);
        }
        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 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>();
        }
Пример #6
0
 /**
  * Add a commit's parents if one does not have a flag set yet.
  * <p>
  * This method permits the application to test if the commit has the given
  * flag; if it does not already have the flag than the commit is added to
  * the queue and the flag is set. This later will prevent the commit from
  * being added twice.
  *
  * @param c
  *            commit whose parents should be added.
  * @param queueControl
  *            flag that controls admission to the queue.
  */
 public void addParents(RevCommit c, RevFlag queueControl)
 {
     RevCommit[] pList = c.parents;
     if (pList == null)
         return;
     foreach (RevCommit p in pList)
         add(p, queueControl);
 }
 public NegotiateBeginRevFilter(RevFlag c, RevFlag a)
 {
     COMMON = c;
     ADVERTISED = a;
 }
Пример #8
0
 /**
  * Add a flag to this object.
  * <p>
  * If the flag is already set on this object then the method has no effect.
  *
  * @param flag
  *            the flag to mark on this object, for later testing.
  */
 public void add(RevFlag flag)
 {
     flags |= flag.mask;
 }
Пример #9
0
 /**
  * Remove a flag from this object.
  * <p>
  * If the flag is not set on this object then the method has no effect.
  *
  * @param flag
  *            the flag to remove from this object.
  */
 public void remove(RevFlag flag)
 {
     flags &= ~flag.mask;
 }
Пример #10
0
 /**
  * Test to see if the flag has been set on this object.
  *
  * @param flag
  *            the flag to test.
  * @return true if the flag has been added to this object; false if not.
  */
 public bool has(RevFlag flag)
 {
     return (flags & flag.mask) != 0;
 }
Пример #11
0
 /// <summary>
 /// Remove a flag from this object.
 /// <para />
 /// If the flag is not set on this object then the method has no effect.
 /// </summary>
 /// <param name="flag">
 /// The flag to remove from this object.
 /// </param>
 public void remove(RevFlag flag)
 {
     Flags &= ~flag.Mask;
 }
Пример #12
0
 /// <summary>
 /// Add a flag to this object.
 /// <para />
 /// If the flag is already set on this object then the method has no effect.
 /// </summary>
 /// <param name="flag">
 /// The flag to mark on this object, for later testing.
 /// </param>
 public void add(RevFlag flag)
 {
     Flags |= flag.Mask;
 }
Пример #13
0
 /**
  * Carry a RevFlag set on this commit to its parents.
  * <p>
  * If this commit is parsed, has parents, and has the supplied flag set on
  * it we automatically add it to the parents, grand-parents, and so on until
  * an unparsed commit or a commit with no parents is discovered. This
  * permits applications to force a flag through the history chain when
  * necessary.
  *
  * @param flag
  *            the single flag value to carry back onto parents.
  */
 public void carry(RevFlag flag)
 {
     int carry = flags & flag.mask;
     if (carry != 0)
         carryFlags(this, carry);
 }
Пример #14
0
 /// <summary>
 /// Carry a RevFlag set on this commit to its parents.
 /// <para />
 /// If this commit is parsed, has parents, and has the supplied flag set on
 /// it we automatically add it to the parents, grand-parents, and so on until
 /// an unparsed commit or a commit with no parents is discovered. This
 /// permits applications to force a flag through the history chain when
 /// necessary.
 /// </summary>
 /// <param name="flag">
 /// The single flag value to carry back onto parents.
 /// </param>
 public void carry(RevFlag flag)
 {
     int carry = Flags & flag.Mask;
     if (carry != 0)
     {
         carryFlags(this, carry);
     }
 }
Пример #15
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 };
        }
 public NegotiateBeginRevFilter(RevFlag c, RevFlag a)
 {
     _common = c;
     _advertised = a;
 }