92
}
93
94
# command line options
95
+my $cmd;
96
my $patch_mode;
97
my $patch_mode_revision;
98
173
},
174
);
175
175
-my %patch_mode_flavour = %{$patch_modes{stage}};
176
+$patch_mode = 'stage';
177
+my %patch_mode_flavour = %{$patch_modes{$patch_mode}};
178
179
sub run_cmd_pipe {
180
if ($^O eq 'MSWin32') {
1310
return $i;
1311
}
1312
1313
+my %patch_update_prompt_modes = (
1314
+ stage => {
1315
+ mode => N__("Stage mode change [y,n,q,a,d,/%s,?]? "),
1316
+ deletion => N__("Stage deletion [y,n,q,a,d,/%s,?]? "),
1317
+ hunk => N__("Stage this hunk [y,n,q,a,d,/%s,?]? "),
1318
+ },
1319
+ stash => {
1320
+ mode => N__("Stash mode change [y,n,q,a,d,/%s,?]? "),
1321
+ deletion => N__("Stash deletion [y,n,q,a,d,/%s,?]? "),
1322
+ hunk => N__("Stash this hunk [y,n,q,a,d,/%s,?]? "),
1323
+ },
1324
+ reset_head => {
1325
+ mode => N__("Unstage mode change [y,n,q,a,d,/%s,?]? "),
1326
+ deletion => N__("Unstage deletion [y,n,q,a,d,/%s,?]? "),
1327
+ hunk => N__("Unstage this hunk [y,n,q,a,d,/%s,?]? "),
1328
+ },
1329
+ reset_nothead => {
1330
+ mode => N__("Apply mode change to index [y,n,q,a,d,/%s,?]? "),
1331
+ deletion => N__("Apply deletion to index [y,n,q,a,d,/%s,?]? "),
1332
+ hunk => N__("Apply this hunk to index [y,n,q,a,d,/%s,?]? "),
1333
+ },
1334
+ checkout_index => {
1335
+ mode => N__("Discard mode change from worktree [y,n,q,a,d,/%s,?]? "),
1336
+ deletion => N__("Discard deletion from worktree [y,n,q,a,d,/%s,?]? "),
1337
+ hunk => N__("Discard this hunk from worktree [y,n,q,a,d,/%s,?]? "),
1338
+ },
1339
+ checkout_head => {
1340
+ mode => N__("Discard mode change from index and worktree [y,n,q,a,d,/%s,?]? "),
1341
+ deletion => N__("Discard deletion from index and worktree [y,n,q,a,d,/%s,?]? "),
1342
+ hunk => N__("Discard this hunk from index and worktree [y,n,q,a,d,/%s,?]? "),
1343
+ },
1344
+ checkout_nothead => {
1345
+ mode => N__("Apply mode change to index and worktree [y,n,q,a,d,/%s,?]? "),
1346
+ deletion => N__("Apply deletion to index and worktree [y,n,q,a,d,/%s,?]? "),
1347
+ hunk => N__("Apply this hunk to index and worktree [y,n,q,a,d,/%s,?]? "),
1348
+ },
1349
+);
1350
+
1351
sub patch_update_file {
1352
my $quit = 0;
1353
my ($ix, $num);
1420
for (@{$hunk[$ix]{DISPLAY}}) {
1421
print;
1422
}
1383
- print colored $prompt_color, $patch_mode_flavour{VERB},
1384
- ($hunk[$ix]{TYPE} eq 'mode' ? ' mode change' :
1385
- $hunk[$ix]{TYPE} eq 'deletion' ? ' deletion' :
1386
- ' this hunk'),
1387
- $patch_mode_flavour{TARGET},
1388
- " [y,n,q,a,d,/$other,?]? ";
1423
+ print colored $prompt_color,
1424
+ sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other);
1425
+
1426
my $line = prompt_single_character;
1427
last unless defined $line;
1428
if ($line) {
1678
die sprintf(__("invalid argument %s, expecting --"),
1679
$arg) unless $arg eq "--";
1680
%patch_mode_flavour = %{$patch_modes{$patch_mode}};
1681
+ $cmd = 1;
1682
}
1683
elsif ($arg ne "--") {
1684
die sprintf(__("invalid argument %s, expecting --"), $arg);
1715
1716
process_args();
1717
refresh();
1680
-if ($patch_mode) {
1718
+if ($cmd) {
1719
patch_update_cmd();
1720
}
1721
else {