Repository: VirtusLab/git-machete

Issue:
Add `t` as an alias for `traverse` (just as `s` is for `status`)

Comments:

Patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 4cb7056..395fed7 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,9 @@
 # Release notes
 
+## New in git-machete 3.6.0
+
+- added: `t` alias for `traverse` command
+
 ## New in git-machete 3.5.0
 
 - added: new way of acquiring the github token (from `~/.github-token`)
diff --git a/docs/source/cli_help/traverse.rst b/docs/source/cli_help/traverse.rst
index 8b23310..d74e384 100644
--- a/docs/source/cli_help/traverse.rst
+++ b/docs/source/cli_help/traverse.rst
@@ -13,10 +13,10 @@ traverse
 
 .. code-block:: shell
 
-    git machete traverse [-F|--fetch] [-l|--list-commits] [-M|--merge]
-                         [-n|--no-edit-merge|--no-interactive-rebase] [--no-detect-squash-merges]
-                         [--[no-]push] [--[no-]push-untracked]
-                         [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes]
+    git machete t[raverse] [-F|--fetch] [-l|--list-commits] [-M|--merge]
+                           [-n|--no-edit-merge|--no-interactive-rebase] [--no-detect-squash-merges]
+                           [--[no-]push] [--[no-]push-untracked]
+                           [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes]
 
 Traverses the branch dependency tree in pre-order (i.e. simply in the order as they occur in the definition file).
 By default traverse starts from current branch, however this behaviour can be customized using options: ``--start-from=``, ``--whole`` or ``-w``, ``-W``.
diff --git a/git_machete/__init__.py b/git_machete/__init__.py
index bf5afe7..826cf62 100644
--- a/git_machete/__init__.py
+++ b/git_machete/__init__.py
@@ -1,1 +1,1 @@
-__version__ = '3.5.1'
+__version__ = '3.6.0'
diff --git a/git_machete/cli.py b/git_machete/cli.py
index 0a4398c..34d369c 100644
--- a/git_machete/cli.py
+++ b/git_machete/cli.py
@@ -26,7 +26,8 @@ alias_by_command: Dict[str, str] = {
     "edit": "e",
     "go": "g",
     "log": "l",
-    "status": "s"
+    "status": "s",
+    "traverse": "t"
 }
 
 command_groups: List[Tuple[str, List[str]]] = [
@@ -316,6 +317,7 @@ def create_cli_parser() -> argparse.ArgumentParser:
 
     traverse_parser = subparsers.add_parser(
         'traverse',
+        aliases=['t'],
         argument_default=argparse.SUPPRESS,
         usage=argparse.SUPPRESS,
         add_help=False,
@@ -748,7 +750,7 @@ def launch(orig_args: List[str]) -> None:
                 opt_list_commits=cli_opts.opt_list_commits,
                 opt_list_commits_with_hashes=cli_opts.opt_list_commits_with_hashes,
                 opt_no_detect_squash_merges=cli_opts.opt_no_detect_squash_merges)
-        elif cmd == "traverse":
+        elif cmd in {"traverse", alias_by_command["traverse"]}:
             if cli_opts.opt_start_from not in {"here", "root", "first-root"}:
                 raise MacheteException(
                     "Invalid argument for `--start-from`. "
diff --git a/git_machete/docs.py b/git_machete/docs.py
index 513561d..803bb3d 100644
--- a/git_machete/docs.py
+++ b/git_machete/docs.py
@@ -606,10 +606,10 @@ long_docs: Dict[str, str] = {
                                             when detecting if a branch is merged into its upstream (parent).
     """,
     "traverse": """
-        <b>Usage: git machete traverse [-F|--fetch] [-l|--list-commits] [-M|--merge]
-                                       [-n|--no-edit-merge|--no-interactive-rebase] [--no-detect-squash-merges]
-                                       [--[no-]push] [--[no-]push-untracked]
-                                       [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes]</b>
+        <b>Usage: git machete t[raverse] [-F|--fetch] [-l|--list-commits] [-M|--merge]
+                                         [-n|--no-edit-merge|--no-interactive-rebase] [--no-detect-squash-merges]
+                                         [--[no-]push] [--[no-]push-untracked]
+                                         [--return-to=WHERE] [--start-from=WHERE] [-w|--whole] [-W] [-y|--yes]</b>
 
         Traverses the branch dependency tree in pre-order (i.e. simply in the order as they occur in the definition file).
         By default traverse starts from current branch, however this behaviour can be customized using options: `--starts-from=`, `--whole` or `-w`, `-W`.


Test patch:
diff --git a/git_machete/tests/functional/test_machete.py b/git_machete/tests/functional/test_machete.py
index 24e5542..53cef1e 100644
--- a/git_machete/tests/functional/test_machete.py
+++ b/git_machete/tests/functional/test_machete.py
@@ -538,8 +538,39 @@ class MacheteTester(unittest.TestCase):
     @mock.patch('git_machete.utils.run_cmd', mock_run_cmd)  # to hide git outputs in tests
     def test_traverse_no_push_override(self) -> None:
         self.setup_discover_standard_tree()
+        self.repo_sandbox.check_out("hotfix/add-trigger")
+        self.launch_command("t", "-Wy", "--no-push", "--push", "--start-from=here")
+        self.assert_command(
+            ["status", "-l"],
+            """
+            develop
+            |
+            | Allow ownership links
+            | 1st round of fixes
+            x-allow-ownership-link (ahead of origin)
+            | |
+            | | Build arbitrarily long chains
+            | x-build-chain (untracked)
+            |
+            | Call web service
+            | 1st round of fixes
+            | 2nd round of fixes
+            o-call-ws (ahead of origin)
+              |
+              | Drop unneeded SQL constraints
+              x-drop-constraint (untracked)
 
-        self.launch_command("traverse", "-Wy", "--no-push", "--push")
+            master
+            |
+            | HOTFIX Add the trigger (amended)
+            o-hotfix/add-trigger *
+              |
+              | Ignore trailing data (amended)
+              o-ignore-trailing
+            """,
+        )
+        self.repo_sandbox.check_out("ignore-trailing")
+        self.launch_command("t", "-Wy", "--no-push", "--push")
         self.assert_command(
             ["status", "-l"],
             """