Frej Drejhammar [Sat, 2 Mar 2024 19:25:29 +0000 (2 20:25 +0100)]
CI: Remove run-tests script
The script should have been removed in
90c6ad5f8759 ("test: use make
to run the tests").
Frej Drejhammar [Fri, 23 Feb 2024 17:04:32 +0000 (23 18:04 +0100)]
Drop manual CodeQL actions
Use default configuration as configured in the web interface instead
of hand-configured ci-actions which gives warnings.
Frej Drejhammar [Fri, 23 Feb 2024 16:07:02 +0000 (23 17:07 +0100)]
Merge branch 'gh/321'
Frej Drejhammar [Fri, 23 Feb 2024 16:04:28 +0000 (23 17:04 +0100)]
Merge branch 'gh/320'
Fixes warnings appearing with Python 3.12.
hg-fast-export.py:231: SyntaxWarning: invalid escape sequence '\.'
Stephan Hohe [Thu, 22 Feb 2024 00:41:05 +0000 (22 01:41 +0100)]
Add tests for plugins setting file content to None
Stephan Hohe [Tue, 20 Feb 2024 16:07:23 +0000 (20 17:07 +0100)]
Don't add file if plugin sets content to `None`
Stephan Hohe [Mon, 19 Feb 2024 22:40:05 +0000 (19 23:40 +0100)]
Fix escape in regular expression
Frej Drejhammar [Fri, 16 Feb 2024 16:56:17 +0000 (16 17:56 +0100)]
Merge branch 'frej/gh318'
Closes #318
Frej Drejhammar [Fri, 16 Feb 2024 16:12:49 +0000 (16 17:12 +0100)]
Run file_data_filter on deleted files
The `file_data_filter` method should be called when files are deleted.
In this case the `data` and `file_ctx` keys map to None. This is so
that a filter which modifies file names can apply the same name
transformations before files are deleted.
Frej Drejhammar [Fri, 16 Feb 2024 16:06:51 +0000 (16 17:06 +0100)]
Make plugin loader look in directories relative to cwd
Make the plugin loader also look for plugins using a path relative to
the current working directory.
Frej Drejhammar [Thu, 28 Dec 2023 12:48:02 +0000 (28 13:48 +0100)]
Merge branch 'frej/run-tests-with-different-python-versions'
Frej Drejhammar [Wed, 27 Dec 2023 12:12:12 +0000 (27 13:12 +0100)]
Run tests with multiple Python versions
Run the CI tests with both the earliest supported Python version and
the latest stable release.
The intent is to quickly notice when new features require adjusting
the oldest supported Python version and also detect when the latest
stable version breaks old code (as when 3.12 removed `imp` and we
witched to `importlib` in #311).
Frej Drejhammar [Wed, 27 Dec 2023 12:09:57 +0000 (27 13:09 +0100)]
Check for a supported Python version on startup
Check that hg-fast-export is running on a supported version of Python
on startup. This is an attempt to avoid problems like #314 in the
future.
Frej Drejhammar [Wed, 27 Dec 2023 12:04:03 +0000 (27 13:04 +0100)]
Update required version of Python to 3.7
Due to problems with handling of Unicode input in Python < 3.7, bump
the required version of Python to 3.7.
Frej Drejhammar [Wed, 27 Dec 2023 11:57:56 +0000 (27 12:57 +0100)]
Add command line flag to dump found versions
Add `--debug` command line flag which dumps the detected versions of
Mercurial and Python. This will probably help future debugging when
unexpected versions are used.
Frej Drejhammar [Thu, 28 Dec 2023 12:39:42 +0000 (28 13:39 +0100)]
Merge branch 'frej/fix-314'
Frej Drejhammar [Wed, 27 Dec 2023 11:52:26 +0000 (27 12:52 +0100)]
Don't look for a Python 2 interpreter
Don't look for a Python 2 interpreter as Python is no longer
supported. If there is a Python 2 available and it had the Mercurial
modules available, hg-fast-export would use it and fail to import
`importlib.machinery`. This is probably the cause of #314.
Closes #314.
Frej Drejhammar [Sat, 18 Nov 2023 19:39:44 +0000 (18 20:39 +0100)]
Merge branch 'PR/312'
Ekin Dursun [Sun, 12 Nov 2023 18:01:31 +0000 (12 21:01 +0300)]
Remove Python 2 compatibility code
Python 2 support was removed recently, so we don't need the
compatibility code anymore.
Frej Drejhammar [Sat, 18 Nov 2023 13:54:53 +0000 (18 14:54 +0100)]
Merge branch 'PR/311'
Closes #311
Ekin Dursun [Sat, 11 Nov 2023 18:09:50 +0000 (11 21:09 +0300)]
Make pluginloader use importlib instead imp
Python 3.12 has removed imp and it's recommended to use importlib
instead. Python 2.7 doesn't have importlib, so Python 2.7 support is
ceased (not a big deal since it's been more than 3 years since it was
EOLed) as a part of this change.
Frej Drejhammar [Mon, 27 Mar 2023 18:35:36 +0000 (27 20:35 +0200)]
Merge branch 'PR/305' into frej/felipec-pr-spree
Closes #305
Frej Drejhammar [Mon, 27 Mar 2023 18:34:17 +0000 (27 20:34 +0200)]
Merge branch 'PR/303' into frej/felipec-pr-spree
Closes #303
Closes #304
Frej Drejhammar [Mon, 27 Mar 2023 18:33:59 +0000 (27 20:33 +0200)]
Merge branch 'PR/302' into frej/felipec-pr-spree
Closes #302
Frej Drejhammar [Mon, 27 Mar 2023 18:33:36 +0000 (27 20:33 +0200)]
Merge branch 'PR/301' into frej/felipec-pr-spree
Closes #301
Felipe Contreras [Mon, 27 Mar 2023 07:53:07 +0000 (27 01:53 -0600)]
github: rename the main action to ci
As in: Continuous Integration.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 07:51:42 +0000 (27 01:51 -0600)]
github: move CodeQL steps into the main action
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 07:46:02 +0000 (27 01:46 -0600)]
github: cleanup codeql action
Based on the latest walk-through: https://github.com/github/codeql-action.
Gets rid of the warning:
Warning: 1 issue was detected with this workflow: git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 01:49:08 +0000 (26 19:49 -0600)]
test: use make to run the tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 02:02:29 +0000 (26 20:02 -0600)]
test: update default location of sharness
It's included as a module for a reason.
Also, use "$0" so the tests can be run like `./t/main.t` (or any other
directory).
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 01:46:38 +0000 (26 19:46 -0600)]
github: update checkout action
Gets rid of the warning:
Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/checkout@v2. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Mon, 27 Mar 2023 01:43:04 +0000 (26 19:43 -0600)]
test: bump sharness to 1.2
It's finally released.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Frej Drejhammar [Sun, 26 Mar 2023 16:40:52 +0000 (26 18:40 +0200)]
Merge branch 'PR/299' into frej/sharness-as-submodule-and-smoke-test
Closes #298
Closes #299
Frej Drejhammar [Fri, 24 Mar 2023 17:36:32 +0000 (24 18:36 +0100)]
Update codeql to version 2
Frej Drejhammar [Fri, 24 Mar 2023 17:19:59 +0000 (24 18:19 +0100)]
Add smoke tests to CI test suite
The added test is an unpublished test, now ported to Sharness, which
has been used by the maintainer to sanity check PRs.
Frej Drejhammar [Fri, 24 Mar 2023 17:19:30 +0000 (24 18:19 +0100)]
Change CI to run tests using test runner
Frej Drejhammar [Fri, 24 Mar 2023 17:11:37 +0000 (24 18:11 +0100)]
Add primitive test runner
Frej Drejhammar [Fri, 24 Mar 2023 16:22:23 +0000 (24 17:22 +0100)]
Add Sharness as a submodule
Felipe Contreras [Tue, 14 Mar 2023 06:47:53 +0000 (14 00:47 -0600)]
Trivial simplification
Just return the values directly, no need to store them into variables.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 03:38:26 +0000 (13 21:38 -0600)]
Remove multiple parent logic for file changes
This is already what repo.status does.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 04:51:05 +0000 (13 22:51 -0600)]
Compare changes only with the first parent
It's not necessary to check both parents.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 04:34:34 +0000 (13 22:34 -0600)]
Remove no-op check
This code is only executed when there's two parents.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 02:37:19 +0000 (13 20:37 -0600)]
Move parents logic inside get_filechanges
This way export_commit is much simpler (already quite complex), and it's
easier to modify the logic.
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 02:32:10 +0000 (13 20:32 -0600)]
Rename variables in get_filechanges
It's easier to understand this way.
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Thu, 9 Mar 2023 21:48:54 +0000 (9 15:48 -0600)]
Simplify split_dict
There's no need to keep track of the left side: if it's modified it's
modified.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Thu, 9 Mar 2023 21:32:54 +0000 (9 15:32 -0600)]
Coalesce modified files
Git doesn't care if they are added or changed: they are modified.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 06:12:19 +0000 (14 00:12 -0600)]
Trivial style cleanup
Checking the array directly is more idiomatic.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Thu, 9 Mar 2023 21:35:50 +0000 (9 15:35 -0600)]
Simplify list of files for the first commit
We already have the files.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Tue, 14 Mar 2023 01:43:23 +0000 (13 19:43 -0600)]
github: enable tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Thu, 9 Mar 2023 20:04:42 +0000 (9 14:04 -0600)]
Add main test
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Frej Drejhammar [Mon, 13 Mar 2023 16:57:20 +0000 (13 17:57 +0100)]
Merge branch 'PR/297'
Closes #297
Felipe Contreras [Fri, 10 Mar 2023 01:21:04 +0000 (9 19:21 -0600)]
Skip earlier
Now that we have ctx easily available, skip early.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 01:17:57 +0000 (9 19:17 -0600)]
Share the changectx more
It's used everywhere, might as well pass it along.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 01:02:39 +0000 (9 19:02 -0600)]
Avoid revsymbol()
We can just do repo[rev].
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:44:01 +0000 (9 18:44 -0600)]
Don't deal with the node in get_changeset()
It's not necessary.
It could be fetched with repo[rev].node(), but why bother?
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:37:02 +0000 (9 18:37 -0600)]
Use revision directly instead of revnode
We don't need the revnode.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:31:02 +0000 (9 18:31 -0600)]
Use changectx directly
There's no need to call repo[revnode] when repo[rev] works perfectly
fine.
And since we have the context already we can just do ctx.hex() instead
of hexlifying ourselves.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:29:46 +0000 (9 18:29 -0600)]
Fetch node directly
No need to call get_changeset() for that.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:13:04 +0000 (9 18:13 -0600)]
Fetch branch names directly
No need to use get_changeset() for just one thing.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 01:04:31 +0000 (9 19:04 -0600)]
Remove cruft
Nothing uses that variable.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 10 Mar 2023 00:08:31 +0000 (9 18:08 -0600)]
hg2git: set proper default branch
So that cfg_master is picked up in get_branch().
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Frej Drejhammar [Sat, 4 Mar 2023 19:21:29 +0000 (4 20:21 +0100)]
Merge branch 'PR/296'
Felipe Contreras [Thu, 2 Mar 2023 00:17:05 +0000 (1 18:17 -0600)]
README: cleanup initial instructions
The `git init` command can create the directory, and HEAD doesn't need
to be specified in `git checkout` (it's the default).
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Frej Drejhammar [Sat, 4 Mar 2023 15:12:26 +0000 (4 16:12 +0100)]
Merge branch 'PR/295'
Closes 295
Felipe Contreras [Fri, 3 Mar 2023 17:23:22 +0000 (3 11:23 -0600)]
Trivial simplification of wr
No need to issue two write commands.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Fri, 3 Mar 2023 17:19:59 +0000 (3 11:19 -0600)]
Add wr_data helper
No functional changes.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Felipe Contreras [Thu, 2 Mar 2023 20:26:24 +0000 (2 14:26 -0600)]
Fix data handling
The length should be exactly the same as the data, for example if the
data is "hello" only 5 characters should be written on the stream. Thus
it should always be `len(data)`, not `len(data)+1` as it currently is in
some places.
Since the first commit of hg2git.py there was a wtf comment, presumably
Rocco was confused about this common discrepancy.
We can shuffle the logic around by adding '\n' to the data, and removing
+1 to the length.
Also, the data should be written without a newline (wr_no_nl).
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Frej Drejhammar [Fri, 25 Nov 2022 15:31:18 +0000 (25 16:31 +0100)]
Merge branch 'PR/294'
df [Sat, 19 Nov 2022 17:15:04 +0000 (19 18:15 +0100)]
Fix typo in README
Added dash to match the actual usage of the 'ignore-unnamed-heads' option
Frej Drejhammar [Sun, 23 Oct 2022 12:47:04 +0000 (23 14:47 +0200)]
Merge branch 'PR/293'
Closes #292
chrisjbillington [Sun, 23 Oct 2022 00:51:33 +0000 (23 11:51 +1100)]
Resolve unicode escape sequences not being processed correctly
In `process_unicode_escape_sequences()`, any backslash escape sequences
in the original string are escaped upon the first
`.encode('unicode-escape')` and therefore round-trip the sequence of
`.encode('unicode-escape').decode('unicode-escape')`.
That is not what we want - we want these sequences to be passed-through
the `.encode` unchanged, so that they will be converted to the
character they represent upon `.decode()`.
This patch changes the `.encode()` step to pass through any ascii
characters unchanged, only escaping non-ascii characters. This ensures
any existing backslash escape sequences will be interpreted as the
character they represent upon `.decode()`.
Frej Drejhammar [Wed, 21 Sep 2022 16:31:16 +0000 (21 18:31 +0200)]
Merge branch 'PR291'
Nicolas Vanhoren [Mon, 19 Sep 2022 14:11:45 +0000 (19 16:11 +0200)]
Update README.md to change recommandation for crlf filtering
Frej Drejhammar [Thu, 10 Feb 2022 19:05:07 +0000 (10 20:05 +0100)]
Merge branch 'frej/submodule-doc-improvement'
Frej Drejhammar [Thu, 10 Feb 2022 19:04:14 +0000 (10 20:04 +0100)]
Merge branch 'frej/fix-re-future-warning'
Frej Drejhammar [Wed, 9 Feb 2022 14:52:56 +0000 (9 15:52 +0100)]
Remove inconsistencies from submodule documentation
The submodule documentation is not consistent with regards to the
example directory structure. Update the example to be consistent.
Closes #277.
Frej Drejhammar [Wed, 9 Feb 2022 14:32:46 +0000 (9 15:32 +0100)]
Fix FutureWarning about nested sets in re
Since Python 3.7 the re module warns for syntax which could, in the
future, be misparsed as a nested set. Avoid this by escaping the
literal `[` we search for in the regexp.
Reported by Monte Davidoff @mndavidoff
Closes #269.
Frej Drejhammar [Fri, 27 Aug 2021 13:47:26 +0000 (27 15:47 +0200)]
Give proper error message when refusing to overwrite existing branch
If fast-export was asked to export a Mercurial branch to Git and a
branch of the same name already existed in the Git repo but it was not
created by fast export, fast-export would crash while trying to format
an error message claiming that the destination branch was modified
behind its back.
This patch extends fast-export to detect the situation above and give
a proper error message which hopefully is less confusing to the user.
Credits for discovering the original crash goes to Shun-ichi Goto
<gotoh@taiyo.co.jp>.
Closes: #269.
Frej Drejhammar [Thu, 29 Jul 2021 13:28:01 +0000 (29 15:28 +0200)]
Update contribution guidelines and make github display them
Try to make it clear that sloppy, throw it over the fence, patches
won't be accepted without revision and try to make sure a potential
contributor sees the warning while creating a pull request.
Frej Drejhammar [Fri, 26 Feb 2021 15:44:31 +0000 (26 16:44 +0100)]
Merge branch 'frej/issue-258'
Closes 258
Frej Drejhammar [Fri, 26 Feb 2021 15:40:12 +0000 (26 16:40 +0100)]
Merge branch 'PR/260'
Closes 257
SirIntellegence [Fri, 19 Feb 2021 20:23:49 +0000 (19 13:23 -0700)]
Add plugin support for the 'extra' field
Permits plugins to import other information such as svn conversion revisions
Frej Drejhammar [Fri, 19 Feb 2021 15:46:37 +0000 (19 16:46 +0100)]
bugfix: Avoid starting incremental conversions from scratch
Keys and values in the state cache are byte strings, therefore a
lookup of 'tip' will always fail. The failure makes the conversion
start over from the beginning, but as fast-export is deterministic the
results are the same, just very inefficient. The bug has existed since
the port to Python 3.
This patch switches the 'tip' lookup to use a byte string which should
make incremental conversions restart at the last converted commit. As
'x' == b'x' in Python 2, this should be a backwards compatible change.
Bug reported and fix suggested by Tomas Kolda.
Fixes #258.
Frej Drejhammar [Sun, 10 Jan 2021 14:18:28 +0000 (10 15:18 +0100)]
Merge branch 'PR/254'
Ray Luo [Fri, 8 Jan 2021 02:41:33 +0000 (7 18:41 -0800)]
Remove some ".py" wording
Avoid confusion about which file is the main entry point to fast-export,
in order to avoid the issue mentioned here
https://github.com/frej/fast-export/issues/158#issuecomment-
754482516
Also fix a typo
Frej Drejhammar [Sun, 15 Nov 2020 14:34:27 +0000 (15 15:34 +0100)]
Merge branch 'PR/251'
Jason Winnebeck [Wed, 4 Nov 2020 23:23:22 +0000 (4 18:23 -0500)]
Document --ignore-unnamed-heads option
Frej Drejhammar [Thu, 29 Oct 2020 18:01:04 +0000 (29 19:01 +0100)]
Merge branch 'PR/247'
Frej Drejhammar [Thu, 29 Oct 2020 18:00:30 +0000 (29 19:00 +0100)]
Fix typo in README
Henrik Tunedal [Wed, 14 Oct 2020 18:53:37 +0000 (14 20:53 +0200)]
Add plugin for dropping commits from output
Frej Drejhammar [Sat, 10 Oct 2020 14:26:53 +0000 (10 16:26 +0200)]
Enable code analysis
Merge github generated workflow into master
Frej Drejhammar [Sat, 10 Oct 2020 13:15:54 +0000 (10 13:15 +0000)]
Create codeql-analysis.yml
Frej Drejhammar [Wed, 30 Sep 2020 15:42:31 +0000 (30 17:42 +0200)]
Allow plugins to modify the committer
Plugins have since they were introduced been able to modify the author
of a commit, but not the committer. This patch adds the necessary
support for allowing them to also modify the committer.
Frej Drejhammar [Wed, 9 Sep 2020 11:27:44 +0000 (9 13:27 +0200)]
Update section about submitting patches in README
Try to cover the most common reasons for requesting changes in PRs.
Frej Drejhammar [Fri, 31 Jul 2020 15:08:04 +0000 (31 17:08 +0200)]
Merge branch 'PR/236-v2' into master
Implement a plugin converting unnamed heads to branches
Ondrej Stanek [Fri, 31 Jul 2020 08:38:24 +0000 (31 10:38 +0200)]
Update head2branch plugin to accept hg commit hash
The revision number isn't a unique identifier of commits across
repository clones and forks, while the hg hash is guaranteed to be stable.
Ondrej Stanek [Wed, 24 Jun 2020 11:50:27 +0000 (24 13:50 +0200)]
Pass original hg commit hash to plugins
Ethan Furman [Thu, 14 Nov 2019 00:19:19 +0000 (13 16:19 -0800)]
Add head2branch plugin
Support converting unnamed heads to named branches during mercurial
conversions.
Co-Authored-By: ostan89@gmail.com
Ethan Furman [Wed, 13 Nov 2019 23:22:15 +0000 (13 15:22 -0800)]
Add revision to commit_data for commit plugins
Co-Authored-By: ostan89@gmail.com
Ondrej Stanek [Fri, 31 Jul 2020 08:30:53 +0000 (31 10:30 +0200)]
Add option --ignore-unnamed-heads
This option allows the user to ignore only unnamed heads (compared to --force
which ignores all non-fatal issues). The intended use is for a future plugin
converting unnamed heads to named branches.