diff options
author | Mike Frysinger <vapier@google.com> | 2019-08-07 17:23:23 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2019-08-08 17:41:40 +0000 |
commit | d5c306b404c321c19191c197c75130d1dc14897a (patch) | |
tree | c07f9fc892c40137cd5642dd13ac85054ed09df7 /subcmds/rebase.py | |
parent | a850ca2712b61cd820a9138c9e97f3fbb583e509 (diff) | |
download | git-repo-d5c306b404c321c19191c197c75130d1dc14897a.tar.gz |
rebase: pull out project-independent settings from the for loop
This makes the code a bit easier to read by doing all the project
independent settings first instead of repeating it for every for
loop iteration.
Change-Id: I4ff21296e444627beba2f4b86561069f5e9a0d73
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/233554
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/rebase.py')
-rw-r--r-- | subcmds/rebase.py | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 9d4b1672..9bc4460c 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
@@ -73,6 +73,21 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
73 | file=sys.stderr) | 73 | file=sys.stderr) |
74 | return 1 | 74 | return 1 |
75 | 75 | ||
76 | # Setup the common git rebase args that we use for all projects. | ||
77 | common_args = ['rebase'] | ||
78 | if opt.whitespace: | ||
79 | common_args.append('--whitespace=%s' % opt.whitespace) | ||
80 | if opt.quiet: | ||
81 | common_args.append('--quiet') | ||
82 | if opt.force_rebase: | ||
83 | common_args.append('--force-rebase') | ||
84 | if opt.no_ff: | ||
85 | common_args.append('--no-ff') | ||
86 | if opt.autosquash: | ||
87 | common_args.append('--autosquash') | ||
88 | if opt.interactive: | ||
89 | common_args.append('-i') | ||
90 | |||
76 | for project in all_projects: | 91 | for project in all_projects: |
77 | cb = project.CurrentBranch | 92 | cb = project.CurrentBranch |
78 | if not cb: | 93 | if not cb: |
@@ -92,26 +107,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
92 | # ignore branches without remotes | 107 | # ignore branches without remotes |
93 | continue | 108 | continue |
94 | 109 | ||
95 | args = ["rebase"] | 110 | args = common_args[:] |
96 | |||
97 | if opt.whitespace: | ||
98 | args.append('--whitespace=%s' % opt.whitespace) | ||
99 | |||
100 | if opt.quiet: | ||
101 | args.append('--quiet') | ||
102 | |||
103 | if opt.force_rebase: | ||
104 | args.append('--force-rebase') | ||
105 | |||
106 | if opt.no_ff: | ||
107 | args.append('--no-ff') | ||
108 | |||
109 | if opt.autosquash: | ||
110 | args.append('--autosquash') | ||
111 | |||
112 | if opt.interactive: | ||
113 | args.append("-i") | ||
114 | |||
115 | if opt.onto_manifest: | 111 | if opt.onto_manifest: |
116 | args.append('--onto') | 112 | args.append('--onto') |
117 | args.append(project.revisionExpr) | 113 | args.append(project.revisionExpr) |