getOldId() public method

public getOldId ( ) : ObjectId
return ObjectId
Beispiel #1
0
        private void Execute(ReceiveCommand cmd)
        {
            try
            {
                RefUpdate ru = db.UpdateRef(cmd.getRefName());
                ru.RefLogIdent = getRefLogIdent();
                switch (cmd.getType())
                {
                case ReceiveCommand.Type.DELETE:
                    if (!ObjectId.ZeroId.Equals(cmd.getOldId()))
                    {
                        ru.ExpectedOldObjectId = cmd.getOldId();
                    }
                    ru.IsForceUpdate = true;
                    Status(cmd, ru.Delete(walk));
                    break;

                case ReceiveCommand.Type.CREATE:
                case ReceiveCommand.Type.UPDATE:
                case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
                    ru.IsForceUpdate       = isAllowNonFastForwards();
                    ru.ExpectedOldObjectId = cmd.getOldId();
                    ru.NewObjectId         = cmd.getNewId();
                    ru.SetRefLogMessage("push", true);
                    Status(cmd, ru.Update(walk));
                    break;
                }
            }
            catch (IOException err)
            {
                cmd.setResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, "lock error: " + err.Message);
            }
        }
Beispiel #2
0
        private void Execute(ReceiveCommand cmd)
        {
            try
            {
                RefUpdate ru = db.UpdateRef(cmd.getRefName());
                ru.setRefLogIdent(getRefLogIdent());
                switch (cmd.getType())
                {
                case ReceiveCommand.Type.DELETE:
                    if (!ObjectId.ZeroId.Equals(cmd.getOldId()))
                    {
                        // We can only do a CAS style delete if the client
                        // didn't bork its delete request by sending the
                        // wrong zero id rather than the advertised one.
                        //
                        ru.setExpectedOldObjectId(cmd.getOldId());
                    }
                    ru.setForceUpdate(true);
                    Status(cmd, ru.delete(walk));
                    break;

                case ReceiveCommand.Type.CREATE:
                case ReceiveCommand.Type.UPDATE:
                case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
                    ru.setForceUpdate(isAllowNonFastForwards());
                    ru.setExpectedOldObjectId(cmd.getOldId());
                    ru.setNewObjectId(cmd.getNewId());
                    ru.setRefLogMessage("push", true);
                    Status(cmd, ru.update(walk));
                    break;
                }
            }
            catch (IOException err)
            {
                cmd.setResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, "lock error: " + err.Message);
            }
        }
Beispiel #3
0
        private void Execute(ReceiveCommand cmd)
        {
            try
            {
                RefUpdate ru = db.UpdateRef(cmd.getRefName());
                ru.RefLogIdent = getRefLogIdent();
                switch (cmd.getType())
                {
                    case ReceiveCommand.Type.DELETE:
                        if (!ObjectId.ZeroId.Equals(cmd.getOldId()))
                        {
                            ru.ExpectedOldObjectId = cmd.getOldId();
                        }
                        ru.IsForceUpdate = true;
                        Status(cmd, ru.Delete(walk));
                        break;

                    case ReceiveCommand.Type.CREATE:
                    case ReceiveCommand.Type.UPDATE:
                    case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
                        ru.IsForceUpdate = isAllowNonFastForwards();
                        ru.ExpectedOldObjectId = cmd.getOldId();
                        ru.NewObjectId = cmd.getNewId();
                        ru.SetRefLogMessage("push", true);
                        Status(cmd, ru.Update(walk));
                        break;
                }
            }
            catch (IOException err)
            {
                cmd.setResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, "lock error: " + err.Message);
            }
        }