git-hot 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_hot-0.1/LICENSE +202 -0
- git_hot-0.1/PKG-INFO +359 -0
- git_hot-0.1/README.md +336 -0
- git_hot-0.1/git-hot.1 +333 -0
- git_hot-0.1/pyproject.toml +79 -0
- git_hot-0.1/setup.cfg +4 -0
- git_hot-0.1/setup.py +64 -0
- git_hot-0.1/src/git_hot/__init__.py +5 -0
- git_hot-0.1/src/git_hot/__main__.py +8 -0
- git_hot-0.1/src/git_hot/daglp.rs +226 -0
- git_hot-0.1/src/git_hot/lifetime.py +1870 -0
- git_hot-0.1/src/git_hot.egg-info/PKG-INFO +359 -0
- git_hot-0.1/src/git_hot.egg-info/SOURCES.txt +14 -0
- git_hot-0.1/src/git_hot.egg-info/dependency_links.txt +1 -0
- git_hot-0.1/src/git_hot.egg-info/entry_points.txt +2 -0
- git_hot-0.1/src/git_hot.egg-info/top_level.txt +1 -0
git_hot-0.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
git_hot-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-hot
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Git extension for reporting source code line lifetime and churn
|
|
5
|
+
Author: Diomidis Spinellis
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/dspinellis/code-lifetime
|
|
8
|
+
Project-URL: Issues, https://github.com/dspinellis/code-lifetime/issues
|
|
9
|
+
Keywords: git,churn,software-evolution,repository-mining
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Rust
|
|
18
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Tools for tracking the lifetime of code lines and tokens
|
|
25
|
+
The tools in this repository allow the precise tracking of when a specific
|
|
26
|
+
code line or token is modified or removed.
|
|
27
|
+
They have been used for conducting the studies described in the
|
|
28
|
+
following paper.
|
|
29
|
+
|
|
30
|
+
Diomidis Spinellis, Panos Louridas, and Maria Kechagia.
|
|
31
|
+
Software evolution: The lifetime of fine-grained elements.
|
|
32
|
+
_PeerJ Computer Science_, 7:e372, February 2021.
|
|
33
|
+
[doi:10.7717/peerj-cs.372](https://dx.doi.org/10.7717/peerj-cs.372)
|
|
34
|
+
|
|
35
|
+
This is the paper's abstract.
|
|
36
|
+
|
|
37
|
+
A model regarding the lifetime of individual source code lines or tokens can
|
|
38
|
+
estimate maintenance effort,
|
|
39
|
+
guide preventive maintenance, and,
|
|
40
|
+
more broadly,
|
|
41
|
+
identify factors that can improve the efficiency of software development.
|
|
42
|
+
We present methods and tools that allow tracking of
|
|
43
|
+
each line's or token's birth and death.
|
|
44
|
+
Through them, we analyze 3.3 billion source code element lifetime events
|
|
45
|
+
in 89 revision control repositories.
|
|
46
|
+
Statistical analysis shows that code lines are durable,
|
|
47
|
+
with a median lifespan of about 2.3 years,
|
|
48
|
+
and that young lines are more likely to be modified or deleted,
|
|
49
|
+
following a Weibull distribution
|
|
50
|
+
with the associated hazard rate decreasing over time.
|
|
51
|
+
This behavior appears to be independent from specific characteristics
|
|
52
|
+
of lines or tokens, as we could not determine factors that
|
|
53
|
+
influence significantly their longevity across projects.
|
|
54
|
+
The programming language,
|
|
55
|
+
and developer tenure and experience were not
|
|
56
|
+
found to be significantly correlated with line or token longevity,
|
|
57
|
+
while project size and project age showed only a slight correlation.
|
|
58
|
+
|
|
59
|
+
The following sections describe the tools included in this repository.
|
|
60
|
+
|
|
61
|
+
## Installation as a package
|
|
62
|
+
|
|
63
|
+
The project is distributed as a Python package named `git-hot`, with the import
|
|
64
|
+
package named `git_hot`.
|
|
65
|
+
Installing it provides the `git-hot` Git extension command and the
|
|
66
|
+
platform-native Rust `daglp` executable.
|
|
67
|
+
Git can invoke `git-hot` as `git hot` when the installation's script directory
|
|
68
|
+
is on `PATH`.
|
|
69
|
+
|
|
70
|
+
For an isolated command installation, use `uv tool`:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
uv tool install git-hot
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For installation in an active virtual environment:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
uv pip install git-hot
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The equivalent `pip` commands are:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
python -m pip install git-hot
|
|
86
|
+
python -m pip install --user git-hot
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use a virtual environment, `uv tool install`, `pipx`, or a user installation
|
|
90
|
+
unless you deliberately manage packages in the system Python. On systems
|
|
91
|
+
following PEP 668, the system Python may reject global pip installs; prefer the
|
|
92
|
+
operating system package manager or an isolated environment instead.
|
|
93
|
+
|
|
94
|
+
## Installation from source
|
|
95
|
+
|
|
96
|
+
Building or installing from source requires Python 3.10 or later and a Rust
|
|
97
|
+
toolchain with `rustc`, because the package build compiles `daglp` from
|
|
98
|
+
`src/git_hot/daglp.rs`. The recommended project workflow uses
|
|
99
|
+
[`uv`](https://docs.astral.sh/uv/), while the package remains standards-based
|
|
100
|
+
and can still be installed by `pip`.
|
|
101
|
+
|
|
102
|
+
For a project-local virtual environment:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
uv venv
|
|
106
|
+
uv pip install .
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For development, use an editable install with the test and lint tools
|
|
110
|
+
installed in the same environment:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
uv sync --group dev
|
|
114
|
+
uv pip install -e .
|
|
115
|
+
uv run python -m unittest discover -s . -p 'test*.py'
|
|
116
|
+
uv run ruff check .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For a user installation, which avoids writing into the system Python:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
uv tool install .
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`uv tool install` installs commands into uv's tool directory, typically
|
|
126
|
+
`~/.local/bin` on Unix-like systems. Ensure that directory is on `PATH`.
|
|
127
|
+
For a classic pip user install, `python -m pip install --user .` also works.
|
|
128
|
+
|
|
129
|
+
For a global installation from source, prefer a distribution package or an
|
|
130
|
+
administrator-managed environment. If a global pip installation is appropriate
|
|
131
|
+
for the machine, run it explicitly through the intended interpreter:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
python -m pip install .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Distribution
|
|
138
|
+
|
|
139
|
+
Build source and wheel distributions with:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
uv build
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The generated artifacts are written below `dist/`.
|
|
146
|
+
The wheel is platform-specific because it contains the compiled `daglp`
|
|
147
|
+
executable. Build wheels separately for each target operating system and
|
|
148
|
+
architecture that should be distributed.
|
|
149
|
+
|
|
150
|
+
Before publishing a release, run:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
uv run --group dev ruff check .
|
|
154
|
+
uv run python -m unittest discover -s . -p 'test*.py'
|
|
155
|
+
uv build
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
To verify the built wheel in an isolated environment:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
uv venv /tmp/git-hot-smoke
|
|
162
|
+
uv pip install --python /tmp/git-hot-smoke/bin/python dist/*.whl
|
|
163
|
+
/tmp/git-hot-smoke/bin/git-hot --help
|
|
164
|
+
/tmp/git-hot-smoke/bin/daglp < /dev/null
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The CI workflow builds and uploads separate wheels through `cibuildwheel` for
|
|
168
|
+
Linux x86_64, Linux aarch64, Windows AMD64, macOS x86_64, and macOS arm64.
|
|
169
|
+
Each wheel contains the single `daglp` executable compiled for that platform.
|
|
170
|
+
Published GitHub releases also publish the source distribution and built wheels
|
|
171
|
+
to PyPI using trusted publishing.
|
|
172
|
+
|
|
173
|
+
The repository also contains research-oriented source tools, including
|
|
174
|
+
`lifetime.py`, `difflog.sh`, `tokenize.pl`, and the original top-level
|
|
175
|
+
`daglp.rs`. These are kept in source form for reproducibility and further
|
|
176
|
+
experimentation, but they are not installed by the `git-hot` package.
|
|
177
|
+
|
|
178
|
+
## lifetime
|
|
179
|
+
The _lifetime_ tool parses the output of successive _git diff_ runs and,
|
|
180
|
+
for every changed or deleted line, outputs a record containing the timestamps
|
|
181
|
+
of the line's creation and deletion.
|
|
182
|
+
Input can be supplied on its standard input or as files specified as arguments.
|
|
183
|
+
To monitor progress in long repositories it also outputs on its standard error
|
|
184
|
+
the SHA hash of each commit being processed.
|
|
185
|
+
When all commits have been processed it outputs the creation timestamps of
|
|
186
|
+
all remaining lines followed by `alive NA`.
|
|
187
|
+
|
|
188
|
+
### Example run
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
git log -M -m --pretty=tformat:'commit %H %ct' --topo-order --reverse -U0 |
|
|
192
|
+
lifetime.pl
|
|
193
|
+
1516281718 1597482365
|
|
194
|
+
1514636783 1597482365
|
|
195
|
+
1591563588 1598358198
|
|
196
|
+
1601804488 1601809923
|
|
197
|
+
1601809923 1601810093
|
|
198
|
+
1601810093 1601821073
|
|
199
|
+
1601809923 1602450156
|
|
200
|
+
1601804488 1603903274
|
|
201
|
+
1601804488 1603903274
|
|
202
|
+
1601821073 1603903274
|
|
203
|
+
1601821073 1603903274
|
|
204
|
+
1525764676 alive NA
|
|
205
|
+
1587747980 alive NA
|
|
206
|
+
1587747980 alive NA
|
|
207
|
+
1587747980 alive NA
|
|
208
|
+
1586362490 alive NA
|
|
209
|
+
1586362490 alive NA
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The tool's operation can be modified through the following command-line
|
|
214
|
+
arguments.
|
|
215
|
+
```
|
|
216
|
+
-c Output in "compressed" format: commit, followed by birthday of deaths
|
|
217
|
+
-d Report the LoC delta
|
|
218
|
+
-D opts Debug as specified by the letters in opts
|
|
219
|
+
C Show commit set changes
|
|
220
|
+
D Show diff headers
|
|
221
|
+
E Show diff extended headers
|
|
222
|
+
H Show each commit SHA, timestamp header
|
|
223
|
+
L Show LoC change processing
|
|
224
|
+
P Show push to change set operations
|
|
225
|
+
R Reconstruct the repository contents from its log
|
|
226
|
+
@ Show range headers
|
|
227
|
+
S Show results of splicing operations
|
|
228
|
+
u Run unit tests
|
|
229
|
+
-e SHA End processing after the specified (full) SHA commit hash
|
|
230
|
+
-E Redirect (debugging) output to stderr
|
|
231
|
+
-f List current files preceded by max line churn, median changed-line
|
|
232
|
+
lifetime, and median line age (rounded integer days)
|
|
233
|
+
-g file Create a growth file with line count of live lines at every commit
|
|
234
|
+
-h Print usage information and exit
|
|
235
|
+
-l Associate with each line details about its composition
|
|
236
|
+
-q Quiet; do not output commit and timestamp on normal processing
|
|
237
|
+
-s Report only changes in source code files (based on their suffix)
|
|
238
|
+
-t Show tokens with lifetime
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## daglp
|
|
242
|
+
The _daglp_ program simplifies Git commit history into a linear graph
|
|
243
|
+
with the most commits, using a [graph longest path algorithm](https://en.wikipedia.org/wiki/Longest_path_problem#Acyclic_graphs_and_critical_paths).
|
|
244
|
+
Given as input a topologically sorted list of each commit's parents,
|
|
245
|
+
it will output the longest path of the directed acyclic graph from the
|
|
246
|
+
beginning (the oldest commit) to the end (the newest one).
|
|
247
|
+
The input is expected to come from a command such as
|
|
248
|
+
`git log --topo-order --pretty=format:'%H %at %P'`.
|
|
249
|
+
The output is a set of "SHA identifier" lines.
|
|
250
|
+
|
|
251
|
+
### Example run
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
$ git log --topo-order --pretty=format:'%H %at %P' | daglp
|
|
255
|
+
13af1997c687bb4462f97ab512e51e8c072a2858 1370686723
|
|
256
|
+
d8e85967adc0b188a49117b5db4f10cc6c7c36cb 1370688578
|
|
257
|
+
27a8ec806f16ae66a7eaa8563220f600c99b9ab9 1370688605
|
|
258
|
+
222f60c28228e189c0986f8c4e86cc5a07e69bfa 1370688896
|
|
259
|
+
a0759fa8d6838170e4b693d26d6edb5e0463c1d0 1370689181
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## difflog
|
|
263
|
+
The _difflog_ tool produces a Git repository's log of changes
|
|
264
|
+
in unified diff format.
|
|
265
|
+
The processed commits are obtained through history simplification using _daglp_.
|
|
266
|
+
The output is roughly the equivalent of running,
|
|
267
|
+
as required by the _lifetime_ tool:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
git -c diff.renameLimit=30000 log -m -M -C --pretty=tformat:'commit %H %at' --topo-order --reverse -U0
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
However, the former command [has been known to produce incorrect results](http://stackoverflow.com/questions/38839595/how-can-i-obtain-with-git-log-a-series-of-patches-that-can-be-auto-applied), which _difflog_ corrects.
|
|
274
|
+
Any command line options are passed as arguments to _git diff_.
|
|
275
|
+
|
|
276
|
+
## tokenize
|
|
277
|
+
The _tokenize_ tool is used to convert the source code commits of a Git
|
|
278
|
+
repository into equivalent ones containing one token per line, as e.g. proposed
|
|
279
|
+
by [cregit](https://github.com/cregit/cregit) and
|
|
280
|
+
[used on the Linux kernel](https://github.com/dmgerman/linux-token-bfg).
|
|
281
|
+
The new repository can then be used for performing token-level diffs.
|
|
282
|
+
|
|
283
|
+
The tool supports code written in Java, C, C#, C++, PHP, and Python,
|
|
284
|
+
as recognized by each file's suffix.
|
|
285
|
+
The tool expects the separate
|
|
286
|
+
[tokenizer](https://github.com/dspinellis/tokenizer) tool to be installed
|
|
287
|
+
and available in its execution path.
|
|
288
|
+
It is invoked with a Git repository directory and branch name as
|
|
289
|
+
argument.
|
|
290
|
+
Its output is suitable for feeding into _git fast-input_.
|
|
291
|
+
Each line in the new repository contains the token 's type
|
|
292
|
+
(KW for keyword,
|
|
293
|
+
NUM for number,
|
|
294
|
+
ID for identifier, and
|
|
295
|
+
TOK for all other tokens),
|
|
296
|
+
followed by the actual token.
|
|
297
|
+
|
|
298
|
+
### Example run
|
|
299
|
+
```
|
|
300
|
+
$ git init tokenized-repo
|
|
301
|
+
$ tokenize.pl repo main | (cd tokenized-repo ; git fast-import)
|
|
302
|
+
|
|
303
|
+
/usr/lib/git-core/git-fast-import statistics:
|
|
304
|
+
---------------------------------------------------------------------
|
|
305
|
+
Alloc'd objects: 5000
|
|
306
|
+
Total objects: 494 ( 91 duplicates )
|
|
307
|
+
blobs : 243 ( 87 duplicates 234 deltas of 237 attempts)
|
|
308
|
+
trees : 141 ( 4 duplicates 138 deltas of 138 attempts)
|
|
309
|
+
commits: 110 ( 0 duplicates 0 deltas of 0 attempts)
|
|
310
|
+
tags : 0 ( 0 duplicates 0 deltas of 0 attempts)
|
|
311
|
+
Total branches: 1 ( 1 loads )
|
|
312
|
+
marks: 1024 ( 440 unique )
|
|
313
|
+
atoms: 54
|
|
314
|
+
Memory total: 2344 KiB
|
|
315
|
+
pools: 2110 KiB
|
|
316
|
+
objects: 234 KiB
|
|
317
|
+
---------------------------------------------------------------------
|
|
318
|
+
pack_report: getpagesize() = 4096
|
|
319
|
+
pack_report: core.packedGitWindowSize = 1073741824
|
|
320
|
+
pack_report: core.packedGitLimit = 35184372088832
|
|
321
|
+
pack_report: pack_used_ctr = 25
|
|
322
|
+
pack_report: pack_mmap_calls = 10
|
|
323
|
+
pack_report: pack_open_windows = 1 / 1
|
|
324
|
+
pack_report: pack_mapped = 237444 / 237444
|
|
325
|
+
---------------------------------------------------------------------
|
|
326
|
+
$ cd tokenized-repo
|
|
327
|
+
$ git show
|
|
328
|
+
commit 1004d9ad8074c774dfe60f8d0527d3eefd20a003 (HEAD -> master)
|
|
329
|
+
Author: Diomidis Spinellis <dds@aueb.gr>
|
|
330
|
+
Date: Fri Feb 8 15:34:17 2019 +0200
|
|
331
|
+
|
|
332
|
+
Handle numbers representing infinity
|
|
333
|
+
|
|
334
|
+
Issue: #10
|
|
335
|
+
|
|
336
|
+
diff --git a/src/TokenId.cpp b/src/TokenId.cpp
|
|
337
|
+
index 35b8296..511e57a 100644
|
|
338
|
+
--- a/src/TokenId.cpp
|
|
339
|
+
+++ b/src/TokenId.cpp
|
|
340
|
+
@@ -37,6 +37,18 @@ KW constexpr
|
|
341
|
+
KW int
|
|
342
|
+
ID TokenId
|
|
343
|
+
TOK ::
|
|
344
|
+
+ID NUMBER_INFINITE
|
|
345
|
+
+TOK ;
|
|
346
|
+
+KW constexpr
|
|
347
|
+
+KW int
|
|
348
|
+
+ID TokenId
|
|
349
|
+
+TOK ::
|
|
350
|
+
+ID NUMBER_NAN
|
|
351
|
+
+TOK ;
|
|
352
|
+
+KW constexpr
|
|
353
|
+
+KW int
|
|
354
|
+
+ID TokenId
|
|
355
|
+
+TOK ::
|
|
356
|
+
ID NUMBER_END
|
|
357
|
+
TOK ;
|
|
358
|
+
KW constexpr
|
|
359
|
+
```
|