Code

Rename tree-parent action to parent
authorJonas Fonseca <fonseca@diku.dk>
Sat, 24 Jan 2009 11:36:03 +0000 (12:36 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Tue, 27 Jan 2009 23:03:52 +0000 (00:03 +0100)
NEWS
manual.txt
tig.c
tigrc.5.txt

diff --git a/NEWS b/NEWS
index 04a1c8305abca00f2bdcac883f247c05f55889f6..6109737b4b05f31a9e0897da398a89ca5beb7bb3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ Incompatibilities:
 
  - The screen-resize action has been deprecated. It had no real use for
    users and was never meant to be exposed.
+ - The "tree-parent" action was renamed to "parent". Warnings will be
+   emitted for transition.
 
 Improvements:
 
index 34bc753237d1b267e028ea9e7df81b5f533daeb2..87f949250f165211d9b3d97942e049286192578c 100644 (file)
@@ -344,6 +344,8 @@ Up  This key is "context sensitive" and will move the cursor one \
        the previous commit in the main view and update the diff view \
        to display it.
 Down   Similar to 'Up' but will move down.
+','    Move to parent. In the tree view, this means switch to the parent \
+       directory.
 -----------------------------------------------------------------------------
 
 [[cursor-nav]]
@@ -419,7 +421,6 @@ M   Resolve unmerged file by launching git-mergetool(1). Note, to work \
 !      Checkout file with unstaged changes. This will reset the file to \
        contain the content it had at last commit.
 @      Move to next chunk in the stage view.
-','    Move tree view to the parent tree.
 e      Open file in editor.
 -----------------------------------------------------------------------------
 
diff --git a/tig.c b/tig.c
index 8c65a4753bb9d2809a7bc93b23d43eb562b8884b..f72932144b4d893db73720d3946da34d15b97ee7 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -666,6 +666,7 @@ static int read_properties(struct io *io, const char *separators, int (*read)(ch
        REQ_(ENTER,             "Enter current line and scroll"), \
        REQ_(NEXT,              "Move to next"), \
        REQ_(PREVIOUS,          "Move to previous"), \
+       REQ_(PARENT,            "Move to parent"), \
        REQ_(VIEW_NEXT,         "Move focus to next view"), \
        REQ_(REFRESH,           "Reload and refresh"), \
        REQ_(MAXIMIZE,          "Maximize the current view"), \
@@ -677,7 +678,6 @@ static int read_properties(struct io *io, const char *separators, int (*read)(ch
        REQ_(STATUS_REVERT,     "Revert file changes"), \
        REQ_(STATUS_MERGE,      "Merge file using external tool"), \
        REQ_(STAGE_NEXT,        "Find next chunk to stage"), \
-       REQ_(TREE_PARENT,       "Switch to parent directory in tree view"), \
        \
        REQ_GROUP("Cursor navigation") \
        REQ_(MOVE_UP,           "Move cursor one line up"), \
@@ -1116,7 +1116,7 @@ static struct keybinding default_keybindings[] = {
        { '!',          REQ_STATUS_REVERT },
        { 'M',          REQ_STATUS_MERGE },
        { '@',          REQ_STAGE_NEXT },
-       { ',',          REQ_TREE_PARENT },
+       { ',',          REQ_PARENT },
        { 'e',          REQ_EDIT },
 };
 
@@ -1551,16 +1551,25 @@ option_bind_command(int argc, const char *argv[])
 
        request = get_request(argv[2]);
        if (request == REQ_NONE) {
-               const char *obsolete[] = { "cherry-pick", "screen-resize" };
+               struct {
+                       const char *name;
+                       enum request request;
+               } obsolete[] = {
+                       { "cherry-pick",        REQ_NONE },
+                       { "screen-resize",      REQ_NONE },
+                       { "tree-parent",        REQ_PARENT },
+               };
                size_t namelen = strlen(argv[2]);
                int i;
 
                for (i = 0; i < ARRAY_SIZE(obsolete); i++) {
-                       if (namelen == strlen(obsolete[i]) &&
-                           !string_enum_compare(obsolete[i], argv[2], namelen)) {
-                               config_msg = "Obsolete request name";
-                               return ERR;
-                       }
+                       if (namelen != strlen(obsolete[i].name) ||
+                           string_enum_compare(obsolete[i].name, argv[2], namelen))
+                               continue;
+                       if (obsolete[i].request != REQ_NONE)
+                               add_keybinding(keymap, obsolete[i].request, key);
+                       config_msg = "Obsolete request name";
+                       return ERR;
                }
        }
        if (request == REQ_NONE && *argv[2]++ == '!')
@@ -3939,7 +3948,7 @@ tree_request(struct view *view, enum request request, struct line *line)
                }
                return REQ_NONE;
 
-       case REQ_TREE_PARENT:
+       case REQ_PARENT:
                if (!*opt_path) {
                        /* quit view if at top of tree */
                        return REQ_VIEW_CLOSE;
index 02af7faa69749f658ff4700134dbb8735f0ba556..3da0d2f9a3a09589206dec85294498d0f303e791 100644 (file)
@@ -220,6 +220,7 @@ View manipulation:
 enter                  Enter current line and scroll
 next                   Move to next
 previous               Move to previous
+parent                 Move to parent
 view-next              Move focus to next view
 refresh                        Reload and refresh view
 maximize               Maximize the current view
@@ -285,7 +286,6 @@ toggle-refs         Toggle reference display
 status-update          Update file status
 status-merge           Resolve unmerged file
 stage-next             Find next chunk to stage
-tree-parent            Switch to parent directory in tree view
 edit                   Open in editor
 ------------------------------------------------------------------------------