From b2157c4750fd495e143b9f842eee06957ea885ff Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 25 Oct 2023 15:27:28 +0300 Subject: [PATCH 1/7] Copy .editorconfig from python/cpython --- .editorconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..0169eed95 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*.{py,c,cpp,h,rst,md,yml}] +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space + +[*.{py,c,cpp,h}] +indent_size = 4 + +[*.rst] +indent_size = 3 + +[*.yml] +indent_size = 2 From 690e3e94fc8dfafd590c277d5bd3bb592f4e5da3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 25 Oct 2023 15:58:51 +0300 Subject: [PATCH 2/7] Update pre-commit config --- .pre-commit-config.yaml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd8154adf..60ea4bc4b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,13 +6,13 @@ repos: args: [--py38-plus] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.0 + rev: 23.12.1 hooks: - id: black args: [--skip-string-normalization] - repo: https://github.com/PyCQA/isort - rev: 5.13.1 + rev: 5.13.2 hooks: - id: isort args: [--profile=black] @@ -21,13 +21,8 @@ repos: rev: 6.1.0 hooks: - id: flake8 - additional_dependencies: [flake8-2020] - - - repo: https://github.com/sphinx-contrib/sphinx-lint - rev: v0.9.1 - hooks: - - id: sphinx-lint - args: ["--enable=default-role"] + additional_dependencies: + [flake8-2020, flake8-implicit-str-concat] - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.10.0 @@ -37,11 +32,24 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - - id: check-json + - id: check-case-conflict - id: check-merge-conflict + - id: check-json - id: check-yaml + - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v0.9.1 + hooks: + - id: sphinx-lint + args: [--enable=default-role] + + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + ci: autoupdate_schedule: quarterly From 86935e3305ab18557ccc9ad3478f4782ea61ce75 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 29 Dec 2023 23:15:42 +0200 Subject: [PATCH 3/7] Document Git worktree --- getting-started/git-boot-camp.rst | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index d8d1a14fe..eeb8a3084 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -669,3 +669,65 @@ Examples of useful commands: * Set the browser:: $ gh config set browser + + +Git worktree +------------ + +When working on several version branches at once, experienced Git users can +take advantage of Git's worktree to check out several branches at once. + +Setting up Git worktree +^^^^^^^^^^^^^^^^^^^^^^^ + +With an existing CPython clone (see :ref:`clone-your-fork`), rename the +``cpython`` directory to ``main`` and move it into a new ``cpython`` +directory, so we have a structure like: + +.. Generated with: tree -L 1 -d cpython + +.. code-block:: text + + cpython + └── main (.git is here) + +Next, create worktrees for the other branches:: + + $ cd cpython/main + $ git worktree add -b 3.11 ../3.11 upstream/3.11 + $ git worktree add -b 3.12 ../3.12 upstream/3.12 + +This gives a structure like this, with the code for each branch checked out in +its own directory: + +.. code-block:: text + + cpython + ├── 3.11 + ├── 3.12 + └── main + +Using Git worktree +^^^^^^^^^^^^^^^^^^ + +List your worktrees, for example:: + + $ git worktree list + /Users/my-name/cpython/main b3d24c40df [main] + /Users/my-name/cpython/3.11 da1736b06a [3.11] + /Users/my-name/cpython/3.12 cf29a2f25e [3.12] + +Change into a directory to work from that branch. For example:: + + $ cd ../3.12 + $ git checkout my-3.12-bugfix-branch + ... + $ cd ../main + $ git checkout my-feature-branch + ... + +.. seealso:: + + * `Git Reference Manual `_ + * `"Experiment on your code freely with Git worktree" + `_ From 3b2636881b40ac42246a70fee975a6957b216a85 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 30 Dec 2023 13:05:07 -0700 Subject: [PATCH 4/7] More concrete example Co-authored-by: Ezio Melotti --- getting-started/git-boot-camp.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index eeb8a3084..f27e6a57d 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -720,10 +720,11 @@ List your worktrees, for example:: Change into a directory to work from that branch. For example:: $ cd ../3.12 - $ git checkout my-3.12-bugfix-branch - ... - $ cd ../main - $ git checkout my-feature-branch + $ git switch -c my-3.12-bugfix-branch # create new branch + $ # make changes, test them, commit + $ git push origin my-3.12-bugfix-branch + $ # create PR + $ git switch 3.12 # switch back to the 3.12 branch ... .. seealso:: From 17512cc9137f4a9cc7b93cf5a711e1238ed7319e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 31 Dec 2023 08:12:54 -0700 Subject: [PATCH 5/7] Improve introductory paragraph Co-authored-by: Ezio Melotti --- getting-started/git-boot-camp.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index f27e6a57d..c15841530 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -674,8 +674,12 @@ Examples of useful commands: Git worktree ------------ -When working on several version branches at once, experienced Git users can -take advantage of Git's worktree to check out several branches at once. +With Git worktrees, you can have multiple isolated working trees +associated with a single repository (the `.git` directory). +This allows you to work simultaneously on different version +branches, eliminating the need for multiple independent clones +that need to be maintained and updated separately. +In addition, it reduces cloning overhead and saves disk space. Setting up Git worktree ^^^^^^^^^^^^^^^^^^^^^^^ From ca9a845c8f55df21649e8a2449c2c1e21bbed8e2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 1 Jan 2024 02:47:26 -0700 Subject: [PATCH 6/7] Trim trailing space Co-authored-by: Itamar Oren --- getting-started/git-boot-camp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index c15841530..dc3452f38 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -677,7 +677,7 @@ Git worktree With Git worktrees, you can have multiple isolated working trees associated with a single repository (the `.git` directory). This allows you to work simultaneously on different version -branches, eliminating the need for multiple independent clones +branches, eliminating the need for multiple independent clones that need to be maintained and updated separately. In addition, it reduces cloning overhead and saves disk space. From 3601b02344c69f5de8fa68884f047f4173197f97 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 3 Jan 2024 14:36:01 +0200 Subject: [PATCH 7/7] Fix lint --- getting-started/git-boot-camp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/git-boot-camp.rst b/getting-started/git-boot-camp.rst index dc3452f38..2bee5c29f 100644 --- a/getting-started/git-boot-camp.rst +++ b/getting-started/git-boot-camp.rst @@ -675,7 +675,7 @@ Git worktree ------------ With Git worktrees, you can have multiple isolated working trees -associated with a single repository (the `.git` directory). +associated with a single repository (the ``.git`` directory). This allows you to work simultaneously on different version branches, eliminating the need for multiple independent clones that need to be maintained and updated separately.