Class PushCommand

    • Constructor Detail

      • PushCommand

        protected PushCommand​(Repository repo)

        Constructor for PushCommand.

        Parameters:
        repo - the Repository
    • Method Detail

      • setRemote

        public PushCommand setRemote​(String remote)
        The remote (uri or name) used for the push operation. If no remote is set, the default value of Constants.DEFAULT_REMOTE_NAME will be used.
        Parameters:
        remote - the remote name
        Returns:
        this
        See Also:
        Constants.DEFAULT_REMOTE_NAME
      • getRemote

        public String getRemote()
        Get remote name
        Returns:
        the remote used for the remote operation
      • setReceivePack

        public PushCommand setReceivePack​(String receivePack)
        The remote executable providing receive-pack service for pack transports. If no receive-pack is set, the default value of RemoteConfig.DEFAULT_RECEIVE_PACK will be used.
        Parameters:
        receivePack - name of the remote executable providing the receive-pack service
        Returns:
        this
        See Also:
        RemoteConfig.DEFAULT_RECEIVE_PACK
      • getReceivePack

        public String getReceivePack()
        Get the name of the remote executable providing the receive-pack service
        Returns:
        the receive-pack used for the remote operation
      • getTimeout

        public int getTimeout()
        Get timeout used for push operation
        Returns:
        the timeout used for the push operation
      • getProgressMonitor

        public ProgressMonitor getProgressMonitor()
        Get the progress monitor
        Returns:
        the progress monitor for the push operation
      • getRefLeaseSpecs

        public List<RefLeaseSpec> getRefLeaseSpecs()
        Get the RefLeaseSpecs.
        Returns:
        the RefLeaseSpecs
        Since:
        4.7
      • setRefLeaseSpecs

        public PushCommand setRefLeaseSpecs​(RefLeaseSpec... specs)
        The ref lease specs to be used in the push operation, for a force-with-lease push operation.
        Parameters:
        specs - a RefLeaseSpec object.
        Returns:
        this
        Since:
        4.7
      • setRefLeaseSpecs

        public PushCommand setRefLeaseSpecs​(List<RefLeaseSpec> specs)
        The ref lease specs to be used in the push operation, for a force-with-lease push operation.
        Parameters:
        specs - list of RefLeaseSpecs
        Returns:
        this
        Since:
        4.7
      • getRefSpecs

        public List<RefSpec> getRefSpecs()
        Get RefSpecs.
        Returns:
        the ref specs
      • setRefSpecs

        public PushCommand setRefSpecs​(RefSpec... specs)
        The ref specs to be used in the push operation
        Parameters:
        specs - a RefSpec object.
        Returns:
        this
      • setRefSpecs

        public PushCommand setRefSpecs​(List<RefSpec> specs)
        The ref specs to be used in the push operation
        Parameters:
        specs - list of RefSpecs
        Returns:
        this
      • setPushAll

        public PushCommand setPushAll()
        Push all branches under refs/heads/*.
        Returns:
        this
      • setPushTags

        public PushCommand setPushTags()
        Push all tags under refs/tags/*.
        Returns:
        this
      • add

        public PushCommand add​(Ref ref)
        Add a reference to push.
        Parameters:
        ref - the source reference. The remote name will match.
        Returns:
        this.
      • add

        public PushCommand add​(String nameOrSpec)
        Add a reference to push.
        Parameters:
        nameOrSpec - any reference name, or a reference specification.
        Returns:
        this.
        Throws:
        JGitInternalException - the reference name cannot be resolved.
      • isDryRun

        public boolean isDryRun()
        Whether to run the push operation as a dry run
        Returns:
        the dry run preference for the push operation
      • setDryRun

        public PushCommand setDryRun​(boolean dryRun)
        Sets whether the push operation should be a dry run
        Parameters:
        dryRun - a boolean.
        Returns:
        this
      • isThin

        public boolean isThin()
        Get the thin-pack preference
        Returns:
        the thin-pack preference for push operation
      • setThin

        public PushCommand setThin​(boolean thin)
        Set the thin-pack preference for push operation. Default setting is Transport.DEFAULT_PUSH_THIN
        Parameters:
        thin - the thin-pack preference value
        Returns:
        this
      • isAtomic

        public boolean isAtomic()
        Whether this push should be executed atomically (all references updated, or none)
        Returns:
        true if all-or-nothing behavior is requested.
        Since:
        4.2
      • setAtomic

        public PushCommand setAtomic​(boolean atomic)
        Requests atomic push (all references updated, or no updates). Default setting is false.
        Parameters:
        atomic - whether to run the push atomically
        Returns:
        this
        Since:
        4.2
      • isForce

        public boolean isForce()
        Whether to push forcefully
        Returns:
        the force preference for push operation
      • setForce

        public PushCommand setForce​(boolean force)
        Sets the force preference for push operation.
        Parameters:
        force - whether to push forcefully
        Returns:
        this
      • setOutputStream

        public PushCommand setOutputStream​(OutputStream out)
        Sets the output stream to write sideband messages to
        Parameters:
        out - an OutputStream
        Returns:
        this
        Since:
        3.0
      • getPushOptions

        public List<String> getPushOptions()
        Get push options
        Returns:
        the option strings associated with the push operation
        Since:
        4.5
      • setPushOptions

        public PushCommand setPushOptions​(List<String> pushOptions)
        Set the option strings associated with the push operation.
        Parameters:
        pushOptions - a List of push option strings
        Returns:
        this
        Since:
        4.5