@@ -150,10 +150,10 @@ enum Cmd {
150
150
#[ clap( long) ]
151
151
base : String ,
152
152
153
- /// Assume a fork exists at stackabletech/<repo_name> and push the base ref to it.
154
- /// The fork URL will be stored in patchable.toml instead of the original upstream.
153
+ /// Assume a mirror exists at stackabletech/<repo_name> and push the base ref to it.
154
+ /// The mirror URL will be stored in patchable.toml instead of the original upstream.
155
155
#[ clap( long) ]
156
- forked : bool ,
156
+ mirrored : bool ,
157
157
} ,
158
158
159
159
/// Shows the patch directory for a given product version
@@ -204,10 +204,10 @@ pub enum Error {
204
204
205
205
#[ snafu( display( "failed to parse upstream URL {url:?} to extract repository name" ) ) ]
206
206
ParseUpstreamUrl { url : String } ,
207
- #[ snafu( display( "failed to add temporary fork remote for {url:?}" ) ) ]
208
- AddForkRemote { source : git2:: Error , url : String } ,
209
- #[ snafu( display( "failed to push commit {commit} (as {refspec}) to fork {url:?}" ) ) ]
210
- PushToFork {
207
+ #[ snafu( display( "failed to add temporary mirror remote for {url:?}" ) ) ]
208
+ AddMirrorRemote { source : git2:: Error , url : String } ,
209
+ #[ snafu( display( "failed to push commit {commit} (as {refspec}) to mirror {url:?}" ) ) ]
210
+ PushToMirror {
211
211
source : git2:: Error ,
212
212
url : String ,
213
213
refspec : String ,
@@ -423,7 +423,7 @@ fn main() -> Result<()> {
423
423
pv,
424
424
upstream,
425
425
base,
426
- forked ,
426
+ mirrored ,
427
427
} => {
428
428
let ctx = ProductVersionContext {
429
429
pv,
@@ -442,14 +442,14 @@ fn main() -> Result<()> {
442
442
// so that it cannot be changed under our feet (without us knowing so, anyway...).
443
443
tracing:: info!( ?base, "resolving base commit-ish" ) ;
444
444
445
- let ( base_commit, upstream) = if forked {
445
+ let ( base_commit, upstream) = if mirrored {
446
446
// Parse e.g. "https://github.com/apache/druid.git" into "druid"
447
447
let repo_name = upstream. split ( '/' ) . last ( ) . map ( |repo| repo. trim_end_matches ( ".git" ) ) . context ( ParseUpstreamUrlSnafu { url : & upstream } ) ?;
448
448
449
449
ensure ! ( !repo_name. is_empty( ) , ParseUpstreamUrlSnafu { url: & upstream } ) ;
450
450
451
- let fork_url = format ! ( "https://github.com/stackabletech/{}.git" , repo_name) ;
452
- tracing:: info!( %fork_url , "using fork repository" ) ;
451
+ let mirror_url = format ! ( "https://github.com/stackabletech/{}.git" , repo_name) ;
452
+ tracing:: info!( %mirror_url , "using mirror repository" ) ;
453
453
454
454
// Fetch from original upstream using a temporary remote name
455
455
tracing:: info!( upstream = upstream, %base, "fetching base ref from original upstream" ) ;
@@ -462,14 +462,14 @@ fn main() -> Result<()> {
462
462
463
463
tracing:: info!( commit = %base_commit_oid, "fetched base commit OID" ) ;
464
464
465
- // Add fork remote
466
- let temp_fork_remote = "patchable_fork_push " ;
467
- let mut fork_remote = product_repo
468
- . remote ( temp_fork_remote , & fork_url )
469
- . context ( AddForkRemoteSnafu { url : fork_url . clone ( ) } ) ?;
465
+ // Add mirror remote
466
+ let temp_mirror_remote = "patchable_mirror_push " ;
467
+ let mut mirror_remote = product_repo
468
+ . remote ( temp_mirror_remote , & mirror_url )
469
+ . context ( AddMirrorRemoteSnafu { url : mirror_url . clone ( ) } ) ?;
470
470
471
- // Push the base commit to the fork
472
- tracing:: info!( commit = %base_commit_oid, base = base, url = fork_url , "pushing commit to fork " ) ;
471
+ // Push the base commit to the mirror
472
+ tracing:: info!( commit = %base_commit_oid, base = base, url = mirror_url , "pushing commit to mirror " ) ;
473
473
let mut callbacks = git2:: RemoteCallbacks :: new ( ) ;
474
474
callbacks. credentials ( |_url, username_from_url, _allowed_types| {
475
475
git2:: Cred :: credential_helper (
@@ -510,20 +510,20 @@ fn main() -> Result<()> {
510
510
511
511
tracing:: info!( refspec = refspec, "constructed push refspec" ) ;
512
512
513
- fork_remote
513
+ mirror_remote
514
514
. push ( & [ & refspec] , Some ( & mut push_options) )
515
- . context ( PushToForkSnafu {
516
- url : fork_url . clone ( ) ,
515
+ . context ( PushToMirrorSnafu {
516
+ url : mirror_url . clone ( ) ,
517
517
refspec : & refspec,
518
518
commit : base_commit_oid,
519
519
} ) ?;
520
520
521
- product_repo. remote_delete ( temp_fork_remote )
522
- . context ( DeleteRemoteSnafu { name : temp_fork_remote . to_string ( ) } ) ?;
521
+ product_repo. remote_delete ( temp_mirror_remote )
522
+ . context ( DeleteRemoteSnafu { name : temp_mirror_remote . to_string ( ) } ) ?;
523
523
524
- tracing:: info!( "successfully pushed base ref to fork " ) ;
524
+ tracing:: info!( "successfully pushed base ref to mirror " ) ;
525
525
526
- ( base_commit_oid, fork_url )
526
+ ( base_commit_oid, mirror_url )
527
527
} else {
528
528
( repo:: resolve_and_fetch_commitish ( & product_repo, & base, & upstream) . context ( FetchBaseCommitSnafu ) ?, upstream)
529
529
} ;
0 commit comments