@@ -195,7 +195,8 @@ public static class WriterImpl<S extends WriterState>
195
195
implements Writer <GitRevision > {
196
196
197
197
final boolean skipPush ;
198
- private final String repoUrl ;
198
+ private final String fetchRepoUrl ;
199
+ private final String pushRepoUrl ;
199
200
private final String remoteFetch ;
200
201
private final String remotePush ;
201
202
@ Nullable private final String tagNameTemplate ;
@@ -218,18 +219,34 @@ public static class WriterImpl<S extends WriterState>
218
219
private final int visitChangePageSize ;
219
220
private final boolean gitTagOverwrite ;
220
221
222
+ @ Deprecated
223
+ WriterImpl (boolean skipPush , String repoUrl , String remoteFetch ,
224
+ String remotePush , String tagNameTemplate , String tagMsgTemplate ,
225
+ GeneralOptions generalOptions , WriteHook writeHook , S state ,
226
+ boolean nonFastForwardPush , Iterable <GitIntegrateChanges > integrates ,
227
+ boolean lastRevFirstParent , boolean ignoreIntegrationErrors , String localRepoPath ,
228
+ String committerName , String committerEmail , boolean rebase , int visitChangePageSize ,
229
+ boolean gitTagOverwrite ) {
230
+ this (
231
+ skipPush , repoUrl , repoUrl , remoteFetch , remotePush , tagNameTemplate , tagMsgTemplate ,
232
+ generalOptions , writeHook , state , nonFastForwardPush , integrates , lastRevFirstParent ,
233
+ ignoreIntegrationErrors , localRepoPath , committerName , committerEmail , rebase ,
234
+ visitChangePageSize , gitTagOverwrite );
235
+ }
236
+
221
237
/**
222
238
* Create a new git.destination writer
223
239
*/
224
- WriterImpl (boolean skipPush , String repoUrl , String remoteFetch ,
240
+ WriterImpl (boolean skipPush , String fetchRepoUrl , String pushRepoUrl , String remoteFetch ,
225
241
String remotePush , String tagNameTemplate , String tagMsgTemplate ,
226
242
GeneralOptions generalOptions , WriteHook writeHook , S state ,
227
243
boolean nonFastForwardPush , Iterable <GitIntegrateChanges > integrates ,
228
244
boolean lastRevFirstParent , boolean ignoreIntegrationErrors , String localRepoPath ,
229
245
String committerName , String committerEmail , boolean rebase , int visitChangePageSize ,
230
246
boolean gitTagOverwrite ) {
231
247
this .skipPush = skipPush ;
232
- this .repoUrl = checkNotNull (repoUrl );
248
+ this .fetchRepoUrl = checkNotNull (fetchRepoUrl );
249
+ this .pushRepoUrl = checkNotNull (pushRepoUrl );
233
250
this .remoteFetch = checkNotNull (remoteFetch );
234
251
this .remotePush = checkNotNull (remotePush );
235
252
this .tagNameTemplate = tagNameTemplate ;
@@ -284,7 +301,7 @@ public void visitChanges(@Nullable GitRevision start, ChangesVisitor visitor)
284
301
private void fetchIfNeeded (GitRepository repo , Console console )
285
302
throws RepoException , ValidationException {
286
303
if (!state .alreadyFetched ) {
287
- GitRevision revision = fetchFromRemote (console , repo , repoUrl , remoteFetch );
304
+ GitRevision revision = fetchFromRemote (console , repo , fetchRepoUrl , remoteFetch );
288
305
if (revision != null ) {
289
306
repo .simpleCommand ("branch" , state .localBranch , revision .getSha1 ());
290
307
}
@@ -344,7 +361,7 @@ private GitRevision getLocalBranchRevision(GitRepository gitRepository) throws R
344
361
return null ;
345
362
}
346
363
throw new RepoException (String .format ("Could not find %s in %s and '%s' was not used" ,
347
- remoteFetch , repoUrl , GeneralOptions .FORCE ));
364
+ remoteFetch , fetchRepoUrl , GeneralOptions .FORCE ));
348
365
}
349
366
}
350
367
@@ -436,7 +453,7 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
436
453
Glob destinationFiles , Console console )
437
454
throws ValidationException , RepoException , IOException {
438
455
logger .atInfo ().log (
439
- "Exporting from %s to: url=%s ref=%s" , transformResult .getPath (), repoUrl , remotePush );
456
+ "Exporting from %s to: url=%s ref=%s" , transformResult .getPath (), pushRepoUrl , remotePush );
440
457
String baseline = transformResult .getBaseline ();
441
458
442
459
GitRepository scratchClone = getRepository (console );
@@ -450,12 +467,12 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
450
467
451
468
if (state .firstWrite ) {
452
469
String reference = baseline != null ? baseline : state .localBranch ;
453
- configForPush (getRepository (console ), repoUrl , remotePush );
470
+ configForPush (getRepository (console ), pushRepoUrl , remotePush );
454
471
if (!force && localBranchRevision == null ) {
455
472
throw new RepoException (String .format (
456
473
"Cannot checkout '%s' from '%s'. Use '%s' if the destination is a new git repo or"
457
474
+ " you don't care about the destination current status" , reference ,
458
- repoUrl ,
475
+ pushRepoUrl ,
459
476
GeneralOptions .FORCE ));
460
477
}
461
478
if (localBranchRevision != null ) {
@@ -468,7 +485,7 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
468
485
} else if (!skipPush ) {
469
486
// Should be a no-op, but an iterative migration could take several minutes between
470
487
// migrations so lets fetch the latest first.
471
- fetchFromRemote (console , scratchClone , repoUrl , remoteFetch );
488
+ fetchFromRemote (console , scratchClone , fetchRepoUrl , remoteFetch );
472
489
}
473
490
474
491
PathMatcher pathMatcher = destinationFiles .relativeTo (scratchClone .getWorkTree ());
@@ -505,7 +522,7 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
505
522
commitMessage );
506
523
507
524
// Don't remove. Used internally in test
508
- console .verboseFmt ("Integrates for %s: %s" , repoUrl , Iterables .size (integrates ));
525
+ console .verboseFmt ("Integrates for %s: %s" , pushRepoUrl , Iterables .size (integrates ));
509
526
510
527
for (GitIntegrateChanges integrate : integrates ) {
511
528
integrate .run (alternate , generalOptions , messageInfo ,
@@ -562,7 +579,7 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
562
579
console .info (DiffUtil .colorize (
563
580
console , scratchClone .simpleCommand ("show" , "HEAD" ).getStdout ()));
564
581
if (!console .promptConfirmation (
565
- String .format ("Proceed with push to %s %s?" , repoUrl , remotePush ))) {
582
+ String .format ("Proceed with push to %s %s?" , pushRepoUrl , remotePush ))) {
566
583
console .warn ("Migration aborted by user." );
567
584
throw new ChangeRejectedException (
568
585
"User aborted execution: did not confirm diff changes." );
@@ -588,15 +605,15 @@ public ImmutableList<DestinationEffect> write(TransformResult transformResult,
588
605
new DestinationEffect .DestinationRef (head .getSha1 (), "commit" , /*url=*/ null )));
589
606
}
590
607
String push = writeHook .getPushReference (getCompleteRef (remotePush ), transformResult );
591
- console .progress (String .format ("Git Destination: Pushing to %s %s" , repoUrl , push ));
608
+ console .progress (String .format ("Git Destination: Pushing to %s %s" , pushRepoUrl , push ));
592
609
checkCondition (!nonFastForwardPush
593
610
|| !Objects .equals (remoteFetch , remotePush ), "non fast-forward push is only"
594
611
+ " allowed when fetch != push" );
595
612
596
613
String serverResponse = generalOptions .repoTask (
597
614
"push" ,
598
615
() -> scratchClone .push ()
599
- .withRefspecs (repoUrl ,
616
+ .withRefspecs (pushRepoUrl ,
600
617
tagName != null
601
618
? ImmutableList .of (scratchClone .createRefSpec (
602
619
(nonFastForwardPush ? "+" : "" ) + "HEAD:" + push ),
@@ -665,7 +682,7 @@ private void updateLocalBranchToBaseline(GitRepository repo, String baseline)
665
682
+ (getLocalBranchRevision (repo ) != null
666
683
? "' from fetch reference '" + remoteFetch + "'"
667
684
: "' and fetch reference '" + remoteFetch + "' itself" )
668
- + " in " + repoUrl + "." );
685
+ + " in " + fetchRepoUrl + "." );
669
686
} else if (baseline != null ) {
670
687
// Update the local branch to use the baseline
671
688
repo .simpleCommand ("update-ref" , state .localBranch , baseline );
0 commit comments