Skip to content

Commit 06338ab

Browse files
vapierLUCI
authored and
LUCI
committed
subcmds: delete redundant dest= settings
Add a test to enforce this too. Change-Id: I80b5cf567aa33db9c24b53428c66d69f9c1d8d74 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/478481 Commit-Queue: Mike Frysinger <[email protected]> Tested-by: Mike Frysinger <[email protected]> Reviewed-by: Scott Lee <[email protected]>
1 parent 8d37f61 commit 06338ab

18 files changed

+45
-52
lines changed

subcmds/abandon.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Abandon(Command):
4848
def _Options(self, p):
4949
p.add_option(
5050
"--all",
51-
dest="all",
5251
action="store_true",
5352
help="delete all branches in all projects",
5453
)

subcmds/diff.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def _Options(self, p):
3535
p.add_option(
3636
"-u",
3737
"--absolute",
38-
dest="absolute",
3938
action="store_true",
4039
help="paths are relative to the repository root",
4140
)

subcmds/diffmanifests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ class Diffmanifests(PagedCommand):
6767

6868
def _Options(self, p):
6969
p.add_option(
70-
"--raw", dest="raw", action="store_true", help="display raw diff"
70+
"--raw",
71+
action="store_true",
72+
help="display raw diff",
7173
)
7274
p.add_option(
7375
"--no-color",
@@ -78,7 +80,6 @@ def _Options(self, p):
7880
)
7981
p.add_option(
8082
"--pretty-format",
81-
dest="pretty_format",
8283
action="store",
8384
metavar="<FORMAT>",
8485
help="print the log using a custom git pretty format string",

subcmds/download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def _Options(self, p):
6060
p.add_option(
6161
"-r",
6262
"--revert",
63-
dest="revert",
6463
action="store_true",
6564
help="revert instead of checkout",
6665
)

subcmds/forall.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,46 +133,41 @@ class Forall(Command, MirrorSafeCommand):
133133

134134
@staticmethod
135135
def _cmd_option(option, _opt_str, _value, parser):
136-
setattr(parser.values, option.dest, list(parser.rargs))
136+
setattr(parser.values, option.dest or "command", list(parser.rargs))
137137
while parser.rargs:
138138
del parser.rargs[0]
139139

140140
def _Options(self, p):
141141
p.add_option(
142142
"-r",
143143
"--regex",
144-
dest="regex",
145144
action="store_true",
146145
help="execute the command only on projects matching regex or "
147146
"wildcard expression",
148147
)
149148
p.add_option(
150149
"-i",
151150
"--inverse-regex",
152-
dest="inverse_regex",
153151
action="store_true",
154152
help="execute the command only on projects not matching regex or "
155153
"wildcard expression",
156154
)
157155
p.add_option(
158156
"-g",
159157
"--groups",
160-
dest="groups",
161158
help="execute the command only on projects matching the specified "
162159
"groups",
163160
)
164161
p.add_option(
165162
"-c",
166163
"--command",
167164
help="command (and arguments) to execute",
168-
dest="command",
169165
action="callback",
170166
callback=self._cmd_option,
171167
)
172168
p.add_option(
173169
"-e",
174170
"--abort-on-errors",
175-
dest="abort_on_errors",
176171
action="store_true",
177172
help="abort if a command exits unsuccessfully",
178173
)

subcmds/grep.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ def _Options(self, p):
120120
g.add_option(
121121
"-r",
122122
"--revision",
123-
dest="revision",
124123
action="append",
125124
metavar="TREEish",
126125
help="Search TREEish, instead of the work tree",

subcmds/info.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ def _Options(self, p):
4343
p.add_option(
4444
"-o",
4545
"--overview",
46-
dest="overview",
4746
action="store_true",
4847
help="show overview of all local commits",
4948
)
5049
p.add_option(
5150
"-c",
5251
"--current-branch",
53-
dest="current_branch",
5452
action="store_true",
5553
help="consider only checked out branches",
5654
)

subcmds/list.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ def _Options(self, p):
4040
p.add_option(
4141
"-r",
4242
"--regex",
43-
dest="regex",
4443
action="store_true",
4544
help="filter the project list based on regex or wildcard matching "
4645
"of strings",
4746
)
4847
p.add_option(
4948
"-g",
5049
"--groups",
51-
dest="groups",
5250
help="filter the project list based on the groups the project is "
5351
"in",
5452
)
@@ -61,21 +59,18 @@ def _Options(self, p):
6159
p.add_option(
6260
"-n",
6361
"--name-only",
64-
dest="name_only",
6562
action="store_true",
6663
help="display only the name of the repository",
6764
)
6865
p.add_option(
6966
"-p",
7067
"--path-only",
71-
dest="path_only",
7268
action="store_true",
7369
help="display only the path of the repository",
7470
)
7571
p.add_option(
7672
"-f",
7773
"--fullpath",
78-
dest="fullpath",
7974
action="store_true",
8075
help="display the full work tree path instead of the relative path",
8176
)

subcmds/manifest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def _Options(self, p):
134134
p.add_option(
135135
"-o",
136136
"--output-file",
137-
dest="output_file",
138137
default="-",
139138
help="file to save the manifest to. (Filename prefix for "
140139
"multi-tree.)",

subcmds/overview.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def _Options(self, p):
3737
p.add_option(
3838
"-c",
3939
"--current-branch",
40-
dest="current_branch",
4140
action="store_true",
4241
help="consider only checked out branches",
4342
)

subcmds/rebase.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,18 @@ def _Options(self, p):
4747
g.add_option(
4848
"-i",
4949
"--interactive",
50-
dest="interactive",
5150
action="store_true",
5251
help="interactive rebase (single project only)",
5352
)
5453

5554
p.add_option(
5655
"--fail-fast",
57-
dest="fail_fast",
5856
action="store_true",
5957
help="stop rebasing after first error is hit",
6058
)
6159
p.add_option(
6260
"-f",
6361
"--force-rebase",
64-
dest="force_rebase",
6562
action="store_true",
6663
help="pass --force-rebase to git rebase",
6764
)
@@ -74,27 +71,23 @@ def _Options(self, p):
7471
)
7572
p.add_option(
7673
"--autosquash",
77-
dest="autosquash",
7874
action="store_true",
7975
help="pass --autosquash to git rebase",
8076
)
8177
p.add_option(
8278
"--whitespace",
83-
dest="whitespace",
8479
action="store",
8580
metavar="WS",
8681
help="pass --whitespace to git rebase",
8782
)
8883
p.add_option(
8984
"--auto-stash",
90-
dest="auto_stash",
9185
action="store_true",
9286
help="stash local modifications before starting",
9387
)
9488
p.add_option(
9589
"-m",
9690
"--onto-manifest",
97-
dest="onto_manifest",
9891
action="store_true",
9992
help="rebase onto the manifest version instead of upstream "
10093
"HEAD (this helps to make sure the local tree stays "

subcmds/selfupdate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _Options(self, p):
5454
)
5555
g.add_option(
5656
"--repo-upgraded",
57-
dest="repo_upgraded",
5857
action="store_true",
5958
help=optparse.SUPPRESS_HELP,
6059
)

subcmds/stage.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def _Options(self, p):
4646
g.add_option(
4747
"-i",
4848
"--interactive",
49-
dest="interactive",
5049
action="store_true",
5150
help="use interactive staging",
5251
)

subcmds/start.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class Start(Command):
5151
def _Options(self, p):
5252
p.add_option(
5353
"--all",
54-
dest="all",
5554
action="store_true",
5655
help="begin branch in all projects",
5756
)

subcmds/status.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def _Options(self, p):
8282
p.add_option(
8383
"-o",
8484
"--orphans",
85-
dest="orphans",
8685
action="store_true",
8786
help="include objects in working directory outside of repo "
8887
"projects",

subcmds/sync.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -373,51 +373,44 @@ def _Options(self, p, show_smart=True):
373373
p.add_option(
374374
"-f",
375375
"--force-broken",
376-
dest="force_broken",
377376
action="store_true",
378377
help="obsolete option (to be deleted in the future)",
379378
)
380379
p.add_option(
381380
"--fail-fast",
382-
dest="fail_fast",
383381
action="store_true",
384382
help="stop syncing after first error is hit",
385383
)
386384
p.add_option(
387385
"--force-sync",
388-
dest="force_sync",
389386
action="store_true",
390387
help="overwrite an existing git directory if it needs to "
391388
"point to a different object directory. WARNING: this "
392389
"may cause loss of data",
393390
)
394391
p.add_option(
395392
"--force-checkout",
396-
dest="force_checkout",
397393
action="store_true",
398394
help="force checkout even if it results in throwing away "
399395
"uncommitted modifications. "
400396
"WARNING: this may cause loss of data",
401397
)
402398
p.add_option(
403399
"--force-remove-dirty",
404-
dest="force_remove_dirty",
405400
action="store_true",
406401
help="force remove projects with uncommitted modifications if "
407402
"projects no longer exist in the manifest. "
408403
"WARNING: this may cause loss of data",
409404
)
410405
p.add_option(
411406
"--rebase",
412-
dest="rebase",
413407
action="store_true",
414408
help="rebase local commits regardless of whether they are "
415409
"published",
416410
)
417411
p.add_option(
418412
"-l",
419413
"--local-only",
420-
dest="local_only",
421414
action="store_true",
422415
help="only update working tree, don't fetch",
423416
)
@@ -433,7 +426,6 @@ def _Options(self, p, show_smart=True):
433426
p.add_option(
434427
"-n",
435428
"--network-only",
436-
dest="network_only",
437429
action="store_true",
438430
help="fetch only, don't update working tree",
439431
)
@@ -460,7 +452,6 @@ def _Options(self, p, show_smart=True):
460452
p.add_option(
461453
"-m",
462454
"--manifest-name",
463-
dest="manifest_name",
464455
help="temporary manifest to use for this sync",
465456
metavar="NAME.xml",
466457
)
@@ -479,19 +470,16 @@ def _Options(self, p, show_smart=True):
479470
"-u",
480471
"--manifest-server-username",
481472
action="store",
482-
dest="manifest_server_username",
483473
help="username to authenticate with the manifest server",
484474
)
485475
p.add_option(
486476
"-p",
487477
"--manifest-server-password",
488478
action="store",
489-
dest="manifest_server_password",
490479
help="password to authenticate with the manifest server",
491480
)
492481
p.add_option(
493482
"--fetch-submodules",
494-
dest="fetch_submodules",
495483
action="store_true",
496484
help="fetch submodules from server",
497485
)
@@ -515,7 +503,6 @@ def _Options(self, p, show_smart=True):
515503
)
516504
p.add_option(
517505
"--optimized-fetch",
518-
dest="optimized_fetch",
519506
action="store_true",
520507
help="only fetch projects fixed to sha1 if revision does not exist "
521508
"locally",
@@ -554,15 +541,13 @@ def _Options(self, p, show_smart=True):
554541
p.add_option(
555542
"-s",
556543
"--smart-sync",
557-
dest="smart_sync",
558544
action="store_true",
559545
help="smart sync using manifest from the latest known good "
560546
"build",
561547
)
562548
p.add_option(
563549
"-t",
564550
"--smart-tag",
565-
dest="smart_tag",
566551
action="store",
567552
help="smart sync using manifest from a known tag",
568553
)
@@ -577,7 +562,6 @@ def _Options(self, p, show_smart=True):
577562
)
578563
g.add_option(
579564
"--repo-upgraded",
580-
dest="repo_upgraded",
581565
action="store_true",
582566
help=optparse.SUPPRESS_HELP,
583567
)

0 commit comments

Comments
 (0)