Skip to content

Commit

Permalink
Reduce redundancy in looping through git tag
Browse files Browse the repository at this point in the history
Update README.md
Release `v2.9`
  • Loading branch information
dormant-user committed Oct 25, 2023
1 parent 226af1e commit 6fcd0f4
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 98 deletions.
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,37 @@ Generate release notes from releases tagged in GitHub
```shell
gitverse-release
```
> :bulb: Tries to get release notes, via GitHub API call.
> If failed, uses the commit message as notes for the associated release.
> This feature optionally takes `GIT_TOKEN` as an environment variable if it is generated for a personal repo.

Generate commit history from git log
> Tries to get release notes, using GitHub API<br>
> If failed, uses the commit message as notes for the associated release<br>
> This feature optionally takes `GIT_TOKEN` as an environment variable if it is generated for a personal repo<br>
<details>
<summary><strong>Known issue related to the order of release notes</strong></summary>

- There is a known issue with GitHub where the `git tag` command returns incorrect timestamp _(when tags are created in different timezones)_
- If the release notes are not generated in the expected order, please run the following command to verify
```shell
git for-each-ref --sort='-creatordate' --format '%(refname:short) %(creatordate:iso8601)' refs/tags
```
- If the output is in expected order, please raise an [issue](https://github.com/thevickypedia/gitverse/issues/new)
</details>

---

#### Commit History
Generate commit history from git log
```shell
gitverse-commit
```

##### Options
---

#### Options
- `debug` - Enable debug mode for logging.
- `reverse` - Generate commit history/release notes in reverse order.

##### Flags
#### Flags
- `-b` Gather commit notes specific to a branch. Uses `Default branch` if not passed. (Only for `gitverse-commit`)
- `-f` Write the commit notes to a custom filename.
- `-t` Title or index line for the file generated.
Expand Down
6 changes: 6 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Commit History
==============

0.5.1 (10/25/2023)
------------------
- Reduce redundancy in looping through `git tag`
- Update README.md
- Release `v2.9`

0.5.0 (10/22/2023)
------------------
- Add dependencies to dynamic in pyproject.toml
Expand Down
33 changes: 22 additions & 11 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,33 +70,46 @@ <h3>Release Notes (Tags)<a class="headerlink" href="#release-notes-tags" title="
</pre></div>
</div>
<blockquote>
<div><p>:bulb: Tries to get release notes, via GitHub API call.
If failed, uses the commit message as notes for the associated release.
This feature optionally takes <code class="docutils literal notranslate"><span class="pre">GIT_TOKEN</span></code> as an environment variable if it is generated for a personal repo.</p>
<div><p>Tries to get release notes, using GitHub API<br>
If failed, uses the commit message as notes for the associated release<br>
This feature optionally takes <code class="docutils literal notranslate"><span class="pre">GIT_TOKEN</span></code> as an environment variable if it is generated for a personal repo<br></p>
</div></blockquote>
<p>Generate commit history from git log</p>
</section>
<details>
<summary><strong>Known issue related to the order of release notes</strong></summary><ul class="simple">
<li><p>There is a known issue with GitHub where the <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">tag</span></code> command returns incorrect timestamp <em>(when tags are created in different timezones)</em></p></li>
<li><p>If the release notes are not generated in the expected order, please run the following command to verify</p></li>
</ul>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span><span class="k">for</span>-each-ref<span class="w"> </span>--sort<span class="o">=</span><span class="s1">&#39;-creatordate&#39;</span><span class="w"> </span>--format<span class="w"> </span><span class="s1">&#39;%(refname:short) %(creatordate:iso8601)&#39;</span><span class="w"> </span>refs/tags
</pre></div>
</div>
<ul class="simple">
<li><p>If the output is in expected order, please raise an <a class="reference external" href="https://github.com/thevickypedia/gitverse/issues/new">issue</a></p></li>
</ul>
</details></section>
<hr class="docutils" />
<section id="commit-history">
<h3>Commit History<a class="headerlink" href="#commit-history" title="Permalink to this heading"></a></h3>
<p>Generate commit history from git log</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>gitverse-commit
</pre></div>
</div>
</section>
<hr class="docutils" />
<section id="options">
<h4>Options<a class="headerlink" href="#options" title="Permalink to this heading"></a></h4>
<h3>Options<a class="headerlink" href="#options" title="Permalink to this heading"></a></h3>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">debug</span></code> - Enable debug mode for logging.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">reverse</span></code> - Generate commit history/release notes in reverse order.</p></li>
</ul>
</section>
<section id="flags">
<h4>Flags<a class="headerlink" href="#flags" title="Permalink to this heading"></a></h4>
<h3>Flags<a class="headerlink" href="#flags" title="Permalink to this heading"></a></h3>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">-b</span></code> Gather commit notes specific to a branch. Uses <code class="docutils literal notranslate"><span class="pre">Default</span> <span class="pre">branch</span></code> if not passed. (Only for <code class="docutils literal notranslate"><span class="pre">gitverse-commit</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-f</span></code> Write the commit notes to a custom filename.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-t</span></code> Title or index line for the file generated.</p></li>
</ul>
</section>
</section>
<section id="sample">
<h3>Sample<a class="headerlink" href="#sample" title="Permalink to this heading"></a></h3>
<p><a class="reference external" href="https://github.com/thevickypedia/gitverse/blob/main/release_notes.rst">release_notes.rst</a></p>
Expand Down Expand Up @@ -146,11 +159,9 @@ <h3><a href="index.html">Table of Contents</a></h3>
<li><a class="reference internal" href="#installation">Installation</a></li>
<li><a class="reference internal" href="#usage">Usage</a><ul>
<li><a class="reference internal" href="#release-notes-tags">Release Notes (Tags)</a></li>
<li><a class="reference internal" href="#commit-history">Commit History</a><ul>
<li><a class="reference internal" href="#commit-history">Commit History</a></li>
<li><a class="reference internal" href="#options">Options</a></li>
<li><a class="reference internal" href="#flags">Flags</a></li>
</ul>
</li>
<li><a class="reference internal" href="#sample">Sample</a></li>
</ul>
</li>
Expand Down
28 changes: 22 additions & 6 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,37 @@ Generate release notes from releases tagged in GitHub
```shell
gitverse-release
```
> :bulb: Tries to get release notes, via GitHub API call.
> If failed, uses the commit message as notes for the associated release.
> This feature optionally takes `GIT_TOKEN` as an environment variable if it is generated for a personal repo.

Generate commit history from git log
> Tries to get release notes, using GitHub API<br>
> If failed, uses the commit message as notes for the associated release<br>
> This feature optionally takes `GIT_TOKEN` as an environment variable if it is generated for a personal repo<br>

<details>
<summary><strong>Known issue related to the order of release notes</strong></summary>

- There is a known issue with GitHub where the `git tag` command returns incorrect timestamp _(when tags are created in different timezones)_
- If the release notes are not generated in the expected order, please run the following command to verify
```shell
git for-each-ref --sort='-creatordate' --format '%(refname:short) %(creatordate:iso8601)' refs/tags
```
- If the output is in expected order, please raise an [issue](https://github.com/thevickypedia/gitverse/issues/new)
</details>

---

#### Commit History
Generate commit history from git log
```shell
gitverse-commit
```

##### Options
---

#### Options
- `debug` - Enable debug mode for logging.
- `reverse` - Generate commit history/release notes in reverse order.

##### Flags
#### Flags
- `-b` Gather commit notes specific to a branch. Uses `Default branch` if not passed. (Only for `gitverse-commit`)
- `-f` Write the commit notes to a custom filename.
- `-t` Title or index line for the file generated.
Expand Down
8 changes: 4 additions & 4 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ <h2 id="G">G</h2>
<li><a href="index.html#gitverse.commits.get_branches">get_branches() (in module gitverse.commits)</a>
</li>
<li><a href="index.html#gitverse.commits.get_commits">get_commits() (in module gitverse.commits)</a>
</li>
<li><a href="index.html#gitverse.releases.get_dates">get_dates() (in module gitverse.releases)</a>
</li>
<li><a href="index.html#gitverse.commits.get_gitlog">get_gitlog() (in module gitverse.commits)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#gitverse.utils.rst.get_release_notes">get_release_notes() (in module gitverse.utils.rst)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#gitverse.releases.get_releases">get_releases() (in module gitverse.releases)</a>
</li>
<li><a href="index.html#gitverse.releases.get_tags">get_tags() (in module gitverse.releases)</a>
</li>
<li>
gitverse.commits
Expand Down
23 changes: 10 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,26 @@ <h1>Welcome to GitVerse’s documentation!<a class="headerlink" href="#welcome-t
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="gitverse.releases.get_dates">
<span class="sig-prename descclassname"><span class="pre">gitverse.releases.</span></span><span class="sig-name descname"><span class="pre">get_dates</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#gitverse.releases.get_dates" title="Permalink to this definition"></a></dt>
<dd><p>Get timestamp for each release.</p>
<dt class="sig sig-object py" id="gitverse.releases.get_releases">
<span class="sig-prename descclassname"><span class="pre">gitverse.releases.</span></span><span class="sig-name descname"><span class="pre">get_releases</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#gitverse.releases.get_releases" title="Permalink to this definition"></a></dt>
<dd><p>Get releases mapped with the timestamp.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns the release version and the timestamp as key-value pairs.</p>
<dd class="field-odd"><p>Returns all the releases information as list of dictionaries.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>Dict[str, int]</p>
<dd class="field-even"><p>Union[List[Dict[str, Union[str, List[str], int, str]]], None]</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="gitverse.releases.get_releases">
<span class="sig-prename descclassname"><span class="pre">gitverse.releases.</span></span><span class="sig-name descname"><span class="pre">get_releases</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#gitverse.releases.get_releases" title="Permalink to this definition"></a></dt>
<dd><p>Get releases mapped with the timestamp.</p>
<dt class="sig sig-object py" id="gitverse.releases.get_tags">
<span class="sig-prename descclassname"><span class="pre">gitverse.releases.</span></span><span class="sig-name descname"><span class="pre">get_tags</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Generator</span><span class="p"><span class="pre">[</span></span><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#gitverse.releases.get_tags" title="Permalink to this definition"></a></dt>
<dd><p>Get all tags for repo and create a dictionary by iterating over each tag for it’s subject.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns all the releases information as list of dictionaries.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p>Union[List[Dict[str, Union[str, List[str], int, str]]], None]</p>
<dt class="field-odd">Yields<span class="colon">:</span></dt>
<dd class="field-odd"><p><em>Dict[str, int]</em> – Yields the release version, description, timestamp and the date for each tag.</p>
</dd>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion docs/objects.inv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Project: GitVerse
# Version:
# The remainder of this file is compressed using zlib.
xڝ��J�0��}��n[�������˒I�m ?%���5|=�Ĥ�3��P�=߹7'm#�����:�kex/�\�9�V-*yk�)��R5��R46�Ͻf(�&����zo�f-�h�q&��4����L‚� +ˉ�„�i�u0�|�ִu�E.�����C��H�Ț)>�QH�9̹�����f~@G�\q�p������8�kn)W$VF��l ����(�t2H�j߅��(��KO ����������h�adz�G�ðn(�Ft��ۈc��?�n��'qB;����`�E�!�w�����l
xڥ�MN�0��9�lQ��!Q!�*�`i���Xr�Ȟ ��\��`Ǥu?q��ͼ�y�&_�:��i[��tò5u��\�kx�l�y���,�7���246�Ͻ�(�&���C��L��h2q&�ʈL��z&aAs����LauZv̾_b��u��S���D6��m@�)o�h�Ry�a�^vP� �g��w��U-9�������f�"�em8)$VF���l ����(Tl *H�j߅�b/��KO�����������[��Œg���ú���m��M��`����Y�������0�'6�
Loading

0 comments on commit 6fcd0f4

Please sign in to comment.