[PATCH 2] renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jeff, thanks!
I'll try to do it better now (not sure who is the mantainer though, I've
seen that you've commited some lines to this file)..

Both patches apply cleanly against c427559 (master).
You can push enhancements directly to 

git://mawercer.de/git_my_patches 
topic branches: 
        renaming_revert_to_reset
        revert_to_reset_renaming

Sincerly
Marc Weber

============= attachement git show output ============================

commit 852b21bf88b1de784244a6e99de9a53a5c61dd8c
Author: Marc Weber <marco-oweber@xxxxxx>
Date:   Sun Oct 5 23:09:04 2008 +0200

    rename the git add -i [r]evert command to [r]eset to use the same term as in git reset
    purpose: decrease possibility of confusion for users with svn background (svn revert = git checkout)
    
    Signed-off-by: Marc Weber <marco-oweber@xxxxxx>

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..5352d16 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,7 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
        }
        print "\n";
 }
@@ -1046,7 +1046,7 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of changes
@@ -1070,7 +1070,7 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],








commit b3d438764a7429e1dfacef8f499a0126076ed2bc
Author: Marc Weber <marco-oweber@xxxxxx>
Date:   Sun Oct 5 15:15:38 2008 +0000

    renamed revert in ga -i to reset, added [c]heckout

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..32c300f 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,31 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
+       }
+       print "\n";
+}
+
+sub checkout_cmd {
+       my @update = list_and_choose({ PROMPT => 'Checkout',
+                                      HEADER => $status_head, },
+                                    list_modified());
+       if (@update) {
+               if (is_initial_commit()) {
+                        # should never be executed because there can't
be modified files
+                        print "error: no revision in repo yet\n";
+               }
+               else {
+                       for (@update) {
+                               if ($_->{INDEX_ADDDEL} &&
+                                   $_->{INDEX_ADDDEL} eq 'create') {
+                                       system(qw(git checkout --),
+                                              $_->{VALUE});
+                               }
+                       }
+               }
+               refresh();
+               say_n_paths('checked out', @update);
        }
        print "\n";
 }
@@ -1046,7 +1070,8 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
+checkout      - reset working copy file back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of
changes
@@ -1070,7 +1095,8 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
+                  [ 'checkout', \&checkout_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux