<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-p4.py, branch v2.35.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.35.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.35.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-01-10T19:52:50Z</updated>
<entry>
<title>Merge branch 'jh/p4-remove-unused'</title>
<updated>2022-01-10T19:52:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9dbb375f94091279e0c9f52f0a3b559a60244da4'/>
<id>urn:sha1:9dbb375f94091279e0c9f52f0a3b559a60244da4</id>
<content type='text'>
Remove a few commands from "git p4" that aren't very useful.

* jh/p4-remove-unused:
  git-p4: remove "rollback" verb
  git-p4: remove "debug" verb
</content>
</entry>
<entry>
<title>Merge branch 'jh/p4-human-unit-numbers'</title>
<updated>2022-01-10T19:52:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=66f6c18e5b8706f07a9a8cbd06942d4c7835f7d7'/>
<id>urn:sha1:66f6c18e5b8706f07a9a8cbd06942d4c7835f7d7</id>
<content type='text'>
The way "git p4" shows file sizes in its output has been updated to
use human-readable units.

* jh/p4-human-unit-numbers:
  git-p4: show progress as an integer
  git-p4: print size values in appropriate units
</content>
</entry>
<entry>
<title>git-p4: remove "rollback" verb</title>
<updated>2021-12-22T21:43:32Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-22T14:55:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0fe3df45f2818d15ec5d542948f08eb035846d08'/>
<id>urn:sha1:0fe3df45f2818d15ec5d542948f08eb035846d08</id>
<content type='text'>
The "rollback" verb implements a simple algorithm which takes the set of
remote perforce tracker branches, or optionally, the complete collection
of local branches in a git repository, and deletes commits from these
branches until there are no commits left with a perforce change number
greater than than a user-specified change number. If the base of a git
branch has a newer change number than the user-specified maximum, then
the branch is deleted.

In future, there might be an argument for the addition of some kind of
"reset this branch back to a given perforce change number" verb for
git-p4. However, in its current form it is unlikely to be useful to
users for the following reasons:

  * The verb is completely undocumented. The only description provided
    contains the following text: "A tool to debug the multi-branch
    import. Don't use :)".

  * The verb has a very narrow purpose in that it applies the rollback
    operation to fixed sets of branches - either all remote p4 branches,
    or all local branches. There is no way for users to specify branches
    with more granularity, for example, allowing users to specify a
    single branch or a set of branches. The utility of the current
    implementation is therefore a niche within a niche.

Given these shortcomings, this patch removes the verb from git-p4.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: remove "debug" verb</title>
<updated>2021-12-22T21:43:32Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-22T14:55:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fb8dfc1ccbc60ea26c63f01071c6809c89d907e5'/>
<id>urn:sha1:fb8dfc1ccbc60ea26c63f01071c6809c89d907e5</id>
<content type='text'>
The git-p4 "debug" verb is described as "A tool to debug the output of
p4 -G".

The verb is not documented in any detail, but implements a function
which executes an arbitrary p4 command with the -G flag, which causes
perforce to format all output as marshalled Python dictionary objects.

The verb was implemented early in the history of git-p4, and may once
have served a useful purpose to the authors in the early stages of
development. However, the "debug" verb is no longer being used by the
current developers (and users) of git-p4, and whatever purpose the verb
previously offered is easily replaced by invoking p4 directly.

This patch therefore removes the verb from git-p4.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: show progress as an integer</title>
<updated>2021-12-20T20:55:26Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-19T15:40:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0f829620e6f2ccc441aef1ffd6c0a546b949ee39'/>
<id>urn:sha1:0f829620e6f2ccc441aef1ffd6c0a546b949ee39</id>
<content type='text'>
When importing files from Perforce, git-p4 periodically logs the
progress of file transfers as a percentage. However, the value is
printed as a float with an excessive number of decimal places.

For example a typical update might contain the following message:

Importing revision 12345 (26.199617677553135%)

This patch simply rounds the value down to the nearest integer
percentage value, greatly improving readability.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Acked-by: Luke Diamand &lt;luke@diamand.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: print size values in appropriate units</title>
<updated>2021-12-20T20:55:09Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-19T15:40:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ae9b9509a76e49cbf4fb254b2b75d566be6434a8'/>
<id>urn:sha1:ae9b9509a76e49cbf4fb254b2b75d566be6434a8</id>
<content type='text'>
The git-p4 script reports file sizes in various log messages.
Previously, in each case the script would print them as the number of
bytes divided by 1048576 i.e. the size in mebibytes, rounded down to an
integer.  This resulted in small files being described as having a size
of "0 MB".

This patch replaces the existing behaviour with a new helper function:
format_size_human_readable, which takes a number of bytes (or any other
quantity), and computes the appropriate prefix to use: none, Ki, Mi, Gi,
Ti, Pi, Ei, Zi, Yi.

For example, a size of 123456 will now be printed as "120.6 KiB" greatly
improving the readability of the log output.

Large valued prefixes such as pebi, exbi, zebi and yobi are included for
completeness, though they not expected to appear in any real-world
Perforce repository!

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: resolve RCS keywords in bytes not utf-8</title>
<updated>2021-12-16T22:06:36Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-16T13:46:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=70c0d55349a50707166f9fb9a9720ac1c0530217'/>
<id>urn:sha1:70c0d55349a50707166f9fb9a9720ac1c0530217</id>
<content type='text'>
RCS keywords are strings that are replaced with information from
Perforce. Examples include $Date$, $Author$, $File$, $Change$ etc.

Perforce resolves these by expanding them with their expanded values
when files are synced, but Git's data model requires these expanded
values to be converted back into their unexpanded form.

Previously, git-p4.py would implement this behaviour through the use of
regular expressions. However, the regular expression substitution was
applied using decoded strings i.e. the content of incoming commit diffs
was first decoded from bytes into UTF-8, processed with regular
expressions, then converted back to bytes.

Not only is this behaviour inefficient, but it is also a cause of a
common issue caused by text files containing invalid UTF-8 data. For
files created in Windows, CP1252 Smart Quote Characters (0x93 and 0x94)
are seen fairly frequently. These codes are invalid in UTF-8, so if the
script encountered any file containing them, on Python 2 the symbols
will be corrupted, and on Python 3 the script will fail with an
exception.

This patch replaces this decoding/encoding with bytes object regular
expressions, so that the substitution is performed directly upon the
source data with no conversions.

A test for smart quote handling has been added to the
t9810-git-p4-rcs.sh test suite.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: open temporary patch file for write only</title>
<updated>2021-12-16T22:06:36Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-16T13:46:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4cf67ae1b6c80eb8a63cc8dd752bd3951cffa104'/>
<id>urn:sha1:4cf67ae1b6c80eb8a63cc8dd752bd3951cffa104</id>
<content type='text'>
The patchRCSKeywords method creates a temporary file in which to store
the patched output data. Previously this file was opened in "w+" mode
(write and read), but the code never reads the contents of the file
while open, so it only needs to be opened in "w" mode (write-only).

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: add raw option to read_pipelines</title>
<updated>2021-12-16T22:06:36Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-16T13:46:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9732e2229c9a1f5285109eecef0dddff16be0ace'/>
<id>urn:sha1:9732e2229c9a1f5285109eecef0dddff16be0ace</id>
<content type='text'>
Previously the read_lines function always decoded the result lines. In
order to improve support for non-decoded binary processing of data in
git-p4.py, this patch adds a raw option to the function that allows
decoding to be disabled.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-p4: pre-compile RCS keyword regexes</title>
<updated>2021-12-16T22:06:35Z</updated>
<author>
<name>Joel Holdsworth</name>
<email>jholdsworth@nvidia.com</email>
</author>
<published>2021-12-16T13:46:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e665e98ec1d1558a55a3e7e5fd5e88d70396ec96'/>
<id>urn:sha1:e665e98ec1d1558a55a3e7e5fd5e88d70396ec96</id>
<content type='text'>
Previously git-p4.py would compile one of two regular expressions for
ever RCS keyword-enabled file. This patch improves simplifies the code
by pre-compiling the two regular expressions when the script first
loads.

Signed-off-by: Joel Holdsworth &lt;jholdsworth@nvidia.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
