|
|
@ -47,13 +47,14 @@ package org.eclipse.jgit.pgm; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.kohsuke.args4j.Argument; |
|
|
|
import org.eclipse.jgit.api.FetchCommand; |
|
|
|
import org.kohsuke.args4j.Option; |
|
|
|
import org.eclipse.jgit.api.Git; |
|
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
|
import org.eclipse.jgit.lib.Constants; |
|
|
|
import org.eclipse.jgit.lib.TextProgressMonitor; |
|
|
|
import org.eclipse.jgit.lib.TextProgressMonitor; |
|
|
|
import org.eclipse.jgit.transport.FetchResult; |
|
|
|
import org.eclipse.jgit.transport.FetchResult; |
|
|
|
import org.eclipse.jgit.transport.RefSpec; |
|
|
|
import org.eclipse.jgit.transport.RefSpec; |
|
|
|
import org.eclipse.jgit.transport.Transport; |
|
|
|
import org.kohsuke.args4j.Argument; |
|
|
|
|
|
|
|
import org.kohsuke.args4j.Option; |
|
|
|
|
|
|
|
|
|
|
|
@Command(common = true, usage = "usage_updateRemoteRefsFromAnotherRepository") |
|
|
|
@Command(common = true, usage = "usage_updateRemoteRefsFromAnotherRepository") |
|
|
|
class Fetch extends AbstractFetchCommand { |
|
|
|
class Fetch extends AbstractFetchCommand { |
|
|
@ -90,24 +91,21 @@ class Fetch extends AbstractFetchCommand { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void run() throws Exception { |
|
|
|
protected void run() throws Exception { |
|
|
|
final Transport tn = Transport.open(db, remote); |
|
|
|
Git git = new Git(db); |
|
|
|
if (fsck != null) |
|
|
|
FetchCommand fetch = git.fetch(); |
|
|
|
tn.setCheckFetchedObjects(fsck.booleanValue()); |
|
|
|
fetch.setCheckFetchedObjects(fsck.booleanValue()); |
|
|
|
if (prune != null) |
|
|
|
fetch.setRemoveDeletedRefs(prune.booleanValue()); |
|
|
|
tn.setRemoveDeletedRefs(prune.booleanValue()); |
|
|
|
fetch.setRefSpecs(toget); |
|
|
|
tn.setDryRun(dryRun); |
|
|
|
fetch.setTimeout(timeout); |
|
|
|
if (thin != null) |
|
|
|
fetch.setDryRun(dryRun); |
|
|
|
tn.setFetchThin(thin.booleanValue()); |
|
|
|
fetch.setRemote(remote); |
|
|
|
if (0 <= timeout) |
|
|
|
fetch.setThin(thin.booleanValue()); |
|
|
|
tn.setTimeout(timeout); |
|
|
|
fetch.setProgressMonitor(new TextProgressMonitor()); |
|
|
|
final FetchResult r; |
|
|
|
|
|
|
|
try { |
|
|
|
FetchResult result = fetch.call(); |
|
|
|
r = tn.fetch(new TextProgressMonitor(), toget); |
|
|
|
if (result.getTrackingRefUpdates().isEmpty()) |
|
|
|
if (r.getTrackingRefUpdates().isEmpty()) |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} finally { |
|
|
|
|
|
|
|
tn.close(); |
|
|
|
showFetchResult(result); |
|
|
|
} |
|
|
|
|
|
|
|
showFetchResult(tn, r); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|