View Javadoc
1   /*
2    * Copyright (C) 2010, 2022 Chris Aniszczyk <caniszczyk@gmail.com> and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.api;
11  
12  import java.io.IOException;
13  import java.io.OutputStream;
14  import java.io.PrintStream;
15  import java.net.URISyntaxException;
16  import java.text.MessageFormat;
17  import java.util.ArrayList;
18  import java.util.Arrays;
19  import java.util.Collection;
20  import java.util.Collections;
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  
25  import org.eclipse.jgit.api.errors.DetachedHeadException;
26  import org.eclipse.jgit.api.errors.GitAPIException;
27  import org.eclipse.jgit.api.errors.InvalidRefNameException;
28  import org.eclipse.jgit.api.errors.InvalidRemoteException;
29  import org.eclipse.jgit.api.errors.JGitInternalException;
30  import org.eclipse.jgit.errors.NotSupportedException;
31  import org.eclipse.jgit.errors.TooLargeObjectInPackException;
32  import org.eclipse.jgit.errors.TooLargePackException;
33  import org.eclipse.jgit.errors.TransportException;
34  import org.eclipse.jgit.internal.JGitText;
35  import org.eclipse.jgit.lib.BranchConfig;
36  import org.eclipse.jgit.lib.Config;
37  import org.eclipse.jgit.lib.ConfigConstants;
38  import org.eclipse.jgit.lib.Constants;
39  import org.eclipse.jgit.lib.NullProgressMonitor;
40  import org.eclipse.jgit.lib.ProgressMonitor;
41  import org.eclipse.jgit.lib.Ref;
42  import org.eclipse.jgit.lib.Repository;
43  import org.eclipse.jgit.transport.PushConfig;
44  import org.eclipse.jgit.transport.PushConfig.PushDefault;
45  import org.eclipse.jgit.transport.PushResult;
46  import org.eclipse.jgit.transport.RefLeaseSpec;
47  import org.eclipse.jgit.transport.RefSpec;
48  import org.eclipse.jgit.transport.RemoteConfig;
49  import org.eclipse.jgit.transport.RemoteRefUpdate;
50  import org.eclipse.jgit.transport.Transport;
51  
52  /**
53   * A class used to execute a {@code Push} command. It has setters for all
54   * supported options and arguments of this command and a {@link #call()} method
55   * to finally execute the command.
56   *
57   * @see <a href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html"
58   *      >Git documentation about Push</a>
59   */
60  public class PushCommand extends
61  		TransportCommand<PushCommand, Iterable<PushResult>> {
62  
63  	private String remote;
64  
65  	private final List<RefSpec> refSpecs;
66  
67  	private final Map<String, RefLeaseSpec> refLeaseSpecs;
68  
69  	private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
70  
71  	private String receivePack = RemoteConfig.DEFAULT_RECEIVE_PACK;
72  
73  	private boolean dryRun;
74  	private boolean atomic;
75  	private boolean force;
76  	private boolean thin = Transport.DEFAULT_PUSH_THIN;
77  	private boolean useBitmaps = Transport.DEFAULT_PUSH_USE_BITMAPS;
78  
79  	private PrintStream hookOutRedirect;
80  
81  	private PrintStream hookErrRedirect;
82  
83  	private OutputStream out;
84  
85  	private List<String> pushOptions;
86  
87  	// Legacy behavior as default. Use setPushDefault(null) to determine the
88  	// value from the git config.
89  	private PushDefault pushDefault = PushDefault.CURRENT;
90  
91  	/**
92  	 * <p>
93  	 * Constructor for PushCommand.
94  	 * </p>
95  	 *
96  	 * @param repo
97  	 *            the {@link org.eclipse.jgit.lib.Repository}
98  	 */
99  	protected PushCommand(Repository repo) {
100 		super(repo);
101 		refSpecs = new ArrayList<>(3);
102 		refLeaseSpecs = new HashMap<>();
103 	}
104 
105 	/**
106 	 * {@inheritDoc}
107 	 * <p>
108 	 * Execute the {@code push} command with all the options and parameters
109 	 * collected by the setter methods of this class. Each instance of this
110 	 * class should only be used for one invocation of the command (means: one
111 	 * call to {@link #call()})
112 	 */
113 	@Override
114 	public Iterable<PushResult> call() throws GitAPIException,
115 			InvalidRemoteException,
116 			org.eclipse.jgit.api.errors.TransportException {
117 		checkCallable();
118 		setCallable(false);
119 
120 		ArrayList<PushResult> pushResults = new ArrayList<>(3);
121 
122 		try {
123 			Config config = repo.getConfig();
124 			remote = determineRemote(config, remote);
125 			if (refSpecs.isEmpty()) {
126 				RemoteConfig rc = new RemoteConfig(config,
127 						getRemote());
128 				refSpecs.addAll(rc.getPushRefSpecs());
129 				if (refSpecs.isEmpty()) {
130 					determineDefaultRefSpecs(config);
131 				}
132 			}
133 
134 			if (force) {
135 				for (int i = 0; i < refSpecs.size(); i++)
136 					refSpecs.set(i, refSpecs.get(i).setForceUpdate(true));
137 			}
138 
139 			List<Transport> transports = Transport.openAll(repo, remote,
140 					Transport.Operation.PUSH);
141 			for (@SuppressWarnings("resource") // Explicitly closed in finally
142 					final Transport transport : transports) {
143 				transport.setPushThin(thin);
144 				transport.setPushAtomic(atomic);
145 				if (receivePack != null)
146 					transport.setOptionReceivePack(receivePack);
147 				transport.setDryRun(dryRun);
148 				transport.setPushOptions(pushOptions);
149 				transport.setPushUseBitmaps(useBitmaps);
150 				transport.setHookOutputStream(hookOutRedirect);
151 				transport.setHookErrorStream(hookErrRedirect);
152 				configure(transport);
153 
154 				final Collection<RemoteRefUpdate> toPush = transport
155 						.findRemoteRefUpdatesFor(refSpecs, refLeaseSpecs);
156 
157 				try {
158 					PushResult result = transport.push(monitor, toPush, out);
159 					pushResults.add(result);
160 
161 				} catch (TooLargePackException e) {
162 					throw new org.eclipse.jgit.api.errors.TooLargePackException(
163 							e.getMessage(), e);
164 				} catch (TooLargeObjectInPackException e) {
165 					throw new org.eclipse.jgit.api.errors.TooLargeObjectInPackException(
166 							e.getMessage(), e);
167 				} catch (TransportException e) {
168 					throw new org.eclipse.jgit.api.errors.TransportException(
169 							e.getMessage(), e);
170 				} finally {
171 					transport.close();
172 				}
173 			}
174 
175 		} catch (URISyntaxException e) {
176 			throw new InvalidRemoteException(
177 					MessageFormat.format(JGitText.get().invalidRemote, remote),
178 					e);
179 		} catch (TransportException e) {
180 			throw new org.eclipse.jgit.api.errors.TransportException(
181 					e.getMessage(), e);
182 		} catch (NotSupportedException e) {
183 			throw new JGitInternalException(
184 					JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
185 					e);
186 		} catch (IOException e) {
187 			throw new JGitInternalException(
188 					JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
189 					e);
190 		}
191 
192 		return pushResults;
193 	}
194 
195 	private String determineRemote(Config config, String remoteName)
196 			throws IOException {
197 		if (remoteName != null) {
198 			return remoteName;
199 		}
200 		Ref head = repo.exactRef(Constants.HEAD);
201 		String effectiveRemote = null;
202 		BranchConfig branchCfg = null;
203 		if (head != null && head.isSymbolic()) {
204 			String currentBranch = head.getLeaf().getName();
205 			branchCfg = new BranchConfig(config,
206 					Repository.shortenRefName(currentBranch));
207 			effectiveRemote = branchCfg.getPushRemote();
208 		}
209 		if (effectiveRemote == null) {
210 			effectiveRemote = config.getString(
211 					ConfigConstants.CONFIG_REMOTE_SECTION, null,
212 					ConfigConstants.CONFIG_KEY_PUSH_DEFAULT);
213 			if (effectiveRemote == null && branchCfg != null) {
214 				effectiveRemote = branchCfg.getRemote();
215 			}
216 		}
217 		if (effectiveRemote == null) {
218 			effectiveRemote = Constants.DEFAULT_REMOTE_NAME;
219 		}
220 		return effectiveRemote;
221 	}
222 
223 	private String getCurrentBranch()
224 			throws IOException, DetachedHeadException {
225 		Ref head = repo.exactRef(Constants.HEAD);
226 		if (head != null && head.isSymbolic()) {
227 			return head.getLeaf().getName();
228 		}
229 		throw new DetachedHeadException();
230 	}
231 
232 	private void determineDefaultRefSpecs(Config config)
233 			throws IOException, GitAPIException {
234 		if (pushDefault == null) {
235 			pushDefault = config.get(PushConfig::new).getPushDefault();
236 		}
237 		switch (pushDefault) {
238 		case CURRENT:
239 			refSpecs.add(new RefSpec(getCurrentBranch()));
240 			break;
241 		case MATCHING:
242 			refSpecs.add(new RefSpec(":")); //$NON-NLS-1$
243 			break;
244 		case NOTHING:
245 			throw new InvalidRefNameException(
246 					JGitText.get().pushDefaultNothing);
247 		case SIMPLE:
248 		case UPSTREAM:
249 			String currentBranch = getCurrentBranch();
250 			BranchConfig branchCfg = new BranchConfig(config,
251 					Repository.shortenRefName(currentBranch));
252 			String fetchRemote = branchCfg.getRemote();
253 			if (fetchRemote == null) {
254 				fetchRemote = Constants.DEFAULT_REMOTE_NAME;
255 			}
256 			boolean isTriangular = !fetchRemote.equals(remote);
257 			if (isTriangular) {
258 				if (PushDefault.UPSTREAM.equals(pushDefault)) {
259 					throw new InvalidRefNameException(MessageFormat.format(
260 							JGitText.get().pushDefaultTriangularUpstream,
261 							remote, fetchRemote));
262 				}
263 				// Strange, but consistent with C git: "simple" doesn't even
264 				// check whether there is a configured upstream, and if so, that
265 				// it is equal to the local branch name. It just becomes
266 				// "current".
267 				refSpecs.add(new RefSpec(currentBranch));
268 			} else {
269 				String trackedBranch = branchCfg.getMerge();
270 				if (branchCfg.isRemoteLocal() || trackedBranch == null
271 						|| !trackedBranch.startsWith(Constants.R_HEADS)) {
272 					throw new InvalidRefNameException(MessageFormat.format(
273 							JGitText.get().pushDefaultNoUpstream,
274 							currentBranch));
275 				}
276 				if (PushDefault.SIMPLE.equals(pushDefault)
277 						&& !trackedBranch.equals(currentBranch)) {
278 					throw new InvalidRefNameException(MessageFormat.format(
279 							JGitText.get().pushDefaultSimple, currentBranch,
280 							trackedBranch));
281 				}
282 				refSpecs.add(new RefSpec(currentBranch + ':' + trackedBranch));
283 			}
284 			break;
285 		default:
286 			throw new InvalidRefNameException(MessageFormat
287 					.format(JGitText.get().pushDefaultUnknown, pushDefault));
288 		}
289 	}
290 
291 	/**
292 	 * The remote (uri or name) used for the push operation. If no remote is
293 	 * set, the default value of <code>Constants.DEFAULT_REMOTE_NAME</code> will
294 	 * be used.
295 	 *
296 	 * @see Constants#DEFAULT_REMOTE_NAME
297 	 * @param remote
298 	 *            the remote name
299 	 * @return {@code this}
300 	 */
301 	public PushCommand setRemote(String remote) {
302 		checkCallable();
303 		this.remote = remote;
304 		return this;
305 	}
306 
307 	/**
308 	 * Get remote name
309 	 *
310 	 * @return the remote used for the remote operation
311 	 */
312 	public String getRemote() {
313 		return remote;
314 	}
315 
316 	/**
317 	 * Sets a {@link PrintStream} a "pre-push" hook may write its stdout to. If
318 	 * not set, {@link System#out} will be used.
319 	 * <p>
320 	 * When pushing to several remote repositories the stream is shared for all
321 	 * pushes.
322 	 * </p>
323 	 *
324 	 * @param redirect
325 	 *            {@link PrintStream} to use; if {@code null},
326 	 *            {@link System#out} will be used
327 	 * @return {@code this}
328 	 * @since 6.4
329 	 */
330 	public PushCommand setHookOutputStream(PrintStream redirect) {
331 		checkCallable();
332 		hookOutRedirect = redirect;
333 		return this;
334 	}
335 
336 	/**
337 	 * Sets a {@link PrintStream} a "pre-push" hook may write its stderr to. If
338 	 * not set, {@link System#err} will be used.
339 	 * <p>
340 	 * When pushing to several remote repositories the stream is shared for all
341 	 * pushes.
342 	 * </p>
343 	 *
344 	 * @param redirect
345 	 *            {@link PrintStream} to use; if {@code null},
346 	 *            {@link System#err} will be used
347 	 * @return {@code this}
348 	 * @since 6.4
349 	 */
350 	public PushCommand setHookErrorStream(PrintStream redirect) {
351 		checkCallable();
352 		hookErrRedirect = redirect;
353 		return this;
354 	}
355 
356 	/**
357 	 * The remote executable providing receive-pack service for pack transports.
358 	 * If no receive-pack is set, the default value of
359 	 * <code>RemoteConfig.DEFAULT_RECEIVE_PACK</code> will be used.
360 	 *
361 	 * @see RemoteConfig#DEFAULT_RECEIVE_PACK
362 	 * @param receivePack
363 	 *            name of the remote executable providing the receive-pack
364 	 *            service
365 	 * @return {@code this}
366 	 */
367 	public PushCommand setReceivePack(String receivePack) {
368 		checkCallable();
369 		this.receivePack = receivePack;
370 		return this;
371 	}
372 
373 	/**
374 	 * Get the name of the remote executable providing the receive-pack service
375 	 *
376 	 * @return the receive-pack used for the remote operation
377 	 */
378 	public String getReceivePack() {
379 		return receivePack;
380 	}
381 
382 	/**
383 	 * Get timeout used for push operation
384 	 *
385 	 * @return the timeout used for the push operation
386 	 */
387 	public int getTimeout() {
388 		return timeout;
389 	}
390 
391 	/**
392 	 * Get the progress monitor
393 	 *
394 	 * @return the progress monitor for the push operation
395 	 */
396 	public ProgressMonitor getProgressMonitor() {
397 		return monitor;
398 	}
399 
400 	/**
401 	 * The progress monitor associated with the push operation. By default, this
402 	 * is set to <code>NullProgressMonitor</code>
403 	 *
404 	 * @see NullProgressMonitor
405 	 * @param monitor
406 	 *            a {@link org.eclipse.jgit.lib.ProgressMonitor}
407 	 * @return {@code this}
408 	 */
409 	public PushCommand setProgressMonitor(ProgressMonitor monitor) {
410 		checkCallable();
411 		if (monitor == null) {
412 			monitor = NullProgressMonitor.INSTANCE;
413 		}
414 		this.monitor = monitor;
415 		return this;
416 	}
417 
418 	/**
419 	 * Get the <code>RefLeaseSpec</code>s.
420 	 *
421 	 * @return the <code>RefLeaseSpec</code>s
422 	 * @since 4.7
423 	 */
424 	public List<RefLeaseSpec> getRefLeaseSpecs() {
425 		return new ArrayList<>(refLeaseSpecs.values());
426 	}
427 
428 	/**
429 	 * The ref lease specs to be used in the push operation, for a
430 	 * force-with-lease push operation.
431 	 *
432 	 * @param specs
433 	 *            a {@link org.eclipse.jgit.transport.RefLeaseSpec} object.
434 	 * @return {@code this}
435 	 * @since 4.7
436 	 */
437 	public PushCommand setRefLeaseSpecs(RefLeaseSpec... specs) {
438 		return setRefLeaseSpecs(Arrays.asList(specs));
439 	}
440 
441 	/**
442 	 * The ref lease specs to be used in the push operation, for a
443 	 * force-with-lease push operation.
444 	 *
445 	 * @param specs
446 	 *            list of {@code RefLeaseSpec}s
447 	 * @return {@code this}
448 	 * @since 4.7
449 	 */
450 	public PushCommand setRefLeaseSpecs(List<RefLeaseSpec> specs) {
451 		checkCallable();
452 		this.refLeaseSpecs.clear();
453 		for (RefLeaseSpec spec : specs) {
454 			refLeaseSpecs.put(spec.getRef(), spec);
455 		}
456 		return this;
457 	}
458 
459 	/**
460 	 * Get {@code RefSpec}s.
461 	 *
462 	 * @return the ref specs
463 	 */
464 	public List<RefSpec> getRefSpecs() {
465 		return refSpecs;
466 	}
467 
468 	/**
469 	 * The ref specs to be used in the push operation
470 	 *
471 	 * @param specs a {@link org.eclipse.jgit.transport.RefSpec} object.
472 	 * @return {@code this}
473 	 */
474 	public PushCommand setRefSpecs(RefSpec... specs) {
475 		checkCallable();
476 		this.refSpecs.clear();
477 		Collections.addAll(refSpecs, specs);
478 		return this;
479 	}
480 
481 	/**
482 	 * The ref specs to be used in the push operation
483 	 *
484 	 * @param specs
485 	 *            list of {@link org.eclipse.jgit.transport.RefSpec}s
486 	 * @return {@code this}
487 	 */
488 	public PushCommand setRefSpecs(List<RefSpec> specs) {
489 		checkCallable();
490 		this.refSpecs.clear();
491 		this.refSpecs.addAll(specs);
492 		return this;
493 	}
494 
495 	/**
496 	 * Retrieves the {@link PushDefault} currently set.
497 	 *
498 	 * @return the {@link PushDefault}, or {@code null} if not set
499 	 * @since 6.1
500 	 */
501 	public PushDefault getPushDefault() {
502 		return pushDefault;
503 	}
504 
505 	/**
506 	 * Sets an explicit {@link PushDefault}. The default used if this is not
507 	 * called is {@link PushDefault#CURRENT} for compatibility reasons with
508 	 * earlier JGit versions.
509 	 *
510 	 * @param pushDefault
511 	 *            {@link PushDefault} to set; if {@code null} the value defined
512 	 *            in the git config will be used.
513 	 *
514 	 * @return {@code this}
515 	 * @since 6.1
516 	 */
517 	public PushCommand setPushDefault(PushDefault pushDefault) {
518 		checkCallable();
519 		this.pushDefault = pushDefault;
520 		return this;
521 	}
522 
523 	/**
524 	 * Push all branches under refs/heads/*.
525 	 *
526 	 * @return {@code this}
527 	 */
528 	public PushCommand setPushAll() {
529 		refSpecs.add(Transport.REFSPEC_PUSH_ALL);
530 		return this;
531 	}
532 
533 	/**
534 	 * Push all tags under refs/tags/*.
535 	 *
536 	 * @return {@code this}
537 	 */
538 	public PushCommand setPushTags() {
539 		refSpecs.add(Transport.REFSPEC_TAGS);
540 		return this;
541 	}
542 
543 	/**
544 	 * Add a reference to push.
545 	 *
546 	 * @param ref
547 	 *            the source reference. The remote name will match.
548 	 * @return {@code this}.
549 	 */
550 	public PushCommand add(Ref ref) {
551 		refSpecs.add(new RefSpec(ref.getLeaf().getName()));
552 		return this;
553 	}
554 
555 	/**
556 	 * Add a reference to push.
557 	 *
558 	 * @param nameOrSpec
559 	 *            any reference name, or a reference specification.
560 	 * @return {@code this}.
561 	 * @throws JGitInternalException
562 	 *             the reference name cannot be resolved.
563 	 */
564 	public PushCommand add(String nameOrSpec) {
565 		if (0 <= nameOrSpec.indexOf(':')) {
566 			refSpecs.add(new RefSpec(nameOrSpec));
567 		} else {
568 			Ref src;
569 			try {
570 				src = repo.findRef(nameOrSpec);
571 			} catch (IOException e) {
572 				throw new JGitInternalException(
573 						JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
574 						e);
575 			}
576 			if (src != null)
577 				add(src);
578 		}
579 		return this;
580 	}
581 
582 	/**
583 	 * Whether to run the push operation as a dry run
584 	 *
585 	 * @return the dry run preference for the push operation
586 	 */
587 	public boolean isDryRun() {
588 		return dryRun;
589 	}
590 
591 	/**
592 	 * Sets whether the push operation should be a dry run
593 	 *
594 	 * @param dryRun a boolean.
595 	 * @return {@code this}
596 	 */
597 	public PushCommand setDryRun(boolean dryRun) {
598 		checkCallable();
599 		this.dryRun = dryRun;
600 		return this;
601 	}
602 
603 	/**
604 	 * Get the thin-pack preference
605 	 *
606 	 * @return the thin-pack preference for push operation
607 	 */
608 	public boolean isThin() {
609 		return thin;
610 	}
611 
612 	/**
613 	 * Set the thin-pack preference for push operation.
614 	 *
615 	 * Default setting is Transport.DEFAULT_PUSH_THIN
616 	 *
617 	 * @param thin
618 	 *            the thin-pack preference value
619 	 * @return {@code this}
620 	 */
621 	public PushCommand setThin(boolean thin) {
622 		checkCallable();
623 		this.thin = thin;
624 		return this;
625 	}
626 
627 	/**
628 	 * Whether to use bitmaps for push.
629 	 *
630 	 * @return true if push use bitmaps.
631 	 * @since 6.4
632 	 */
633 	public boolean isUseBitmaps() {
634 		return useBitmaps;
635 	}
636 
637 	/**
638 	 * Set whether to use bitmaps for push.
639 	 *
640 	 * Default setting is {@value Transport#DEFAULT_PUSH_USE_BITMAPS}
641 	 *
642 	 * @param useBitmaps
643 	 *            false to disable use of bitmaps for push, true otherwise.
644 	 * @return {@code this}
645 	 * @since 6.4
646 	 */
647 	public PushCommand setUseBitmaps(boolean useBitmaps) {
648 		checkCallable();
649 		this.useBitmaps = useBitmaps;
650 		return this;
651 	}
652 
653 	/**
654 	 * Whether this push should be executed atomically (all references updated,
655 	 * or none)
656 	 *
657 	 * @return true if all-or-nothing behavior is requested.
658 	 * @since 4.2
659 	 */
660 	public boolean isAtomic() {
661 		return atomic;
662 	}
663 
664 	/**
665 	 * Requests atomic push (all references updated, or no updates).
666 	 *
667 	 * Default setting is false.
668 	 *
669 	 * @param atomic
670 	 *            whether to run the push atomically
671 	 * @return {@code this}
672 	 * @since 4.2
673 	 */
674 	public PushCommand setAtomic(boolean atomic) {
675 		checkCallable();
676 		this.atomic = atomic;
677 		return this;
678 	}
679 
680 	/**
681 	 * Whether to push forcefully
682 	 *
683 	 * @return the force preference for push operation
684 	 */
685 	public boolean isForce() {
686 		return force;
687 	}
688 
689 	/**
690 	 * Sets the force preference for push operation.
691 	 *
692 	 * @param force
693 	 *            whether to push forcefully
694 	 * @return {@code this}
695 	 */
696 	public PushCommand setForce(boolean force) {
697 		checkCallable();
698 		this.force = force;
699 		return this;
700 	}
701 
702 	/**
703 	 * Sets the output stream to write sideband messages to
704 	 *
705 	 * @param out
706 	 *            an {@link java.io.OutputStream}
707 	 * @return {@code this}
708 	 * @since 3.0
709 	 */
710 	public PushCommand setOutputStream(OutputStream out) {
711 		this.out = out;
712 		return this;
713 	}
714 
715 	/**
716 	 * Get push options
717 	 *
718 	 * @return the option strings associated with the push operation
719 	 * @since 4.5
720 	 */
721 	public List<String> getPushOptions() {
722 		return pushOptions;
723 	}
724 
725 	/**
726 	 * Set the option strings associated with the push operation.
727 	 *
728 	 * @param pushOptions
729 	 *            a {@link java.util.List} of push option strings
730 	 * @return {@code this}
731 	 * @since 4.5
732 	 */
733 	public PushCommand setPushOptions(List<String> pushOptions) {
734 		this.pushOptions = pushOptions;
735 		return this;
736 	}
737 }