Commit Graph

602 Commits

Author SHA1 Message Date
Frej Drejhammar
c8fa290adf Merge branch 'PR/312' 2023-11-18 20:39:44 +01:00
Ekin Dursun
c49dd0cf60 Remove Python 2 compatibility code
Python 2 support was removed recently, so we don't need the
compatibility code anymore.
2023-11-18 20:22:18 +03:00
Frej Drejhammar
4f94d61d84 Merge branch 'PR/311'
Closes #311
2023-11-18 14:54:53 +01:00
Ekin Dursun
a3d0562737 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.
2023-11-12 20:41:43 +03:00
Frej Drejhammar
0d0e90d328 Merge branch 'PR/305' into frej/felipec-pr-spree
Closes #305
v231118
2023-03-27 20:35:36 +02:00
Frej Drejhammar
64ee34dfb0 Merge branch 'PR/303' into frej/felipec-pr-spree
Closes #303
Closes #304
2023-03-27 20:34:17 +02:00
Frej Drejhammar
71834a584c Merge branch 'PR/302' into frej/felipec-pr-spree
Closes #302
2023-03-27 20:33:59 +02:00
Frej Drejhammar
4310e47760 Merge branch 'PR/301' into frej/felipec-pr-spree
Closes #301
2023-03-27 20:33:36 +02:00
Felipe Contreras
278cc9966c github: rename the main action to ci
As in: Continuous Integration.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-27 01:54:00 -06:00
Felipe Contreras
cf66c36a32 github: move CodeQL steps into the main action
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-27 01:53:49 -06:00
Felipe Contreras
269c23c5bb 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>
2023-03-27 01:49:29 -06:00
Felipe Contreras
90c6ad5f87 test: use make to run the tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-26 20:05:03 -06:00
Felipe Contreras
51db3b4236 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>
2023-03-26 20:04:38 -06:00
Felipe Contreras
fba03b95fb 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>
2023-03-26 19:46:38 -06:00
Felipe Contreras
2cc7db7556 test: bump sharness to 1.2
It's finally released.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-26 19:43:04 -06:00
Frej Drejhammar
a89033b5b1 Merge branch 'PR/299' into frej/sharness-as-submodule-and-smoke-test
Closes #298
Closes #299
2023-03-26 18:40:52 +02:00
Frej Drejhammar
fd5bd48a6c Update codeql to version 2 2023-03-26 16:48:07 +02:00
Frej Drejhammar
84a877d112 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.
2023-03-26 16:48:07 +02:00
Frej Drejhammar
3f57c4340a Change CI to run tests using test runner 2023-03-24 18:46:53 +01:00
Frej Drejhammar
1e872eb235 Add primitive test runner 2023-03-24 18:11:37 +01:00
Frej Drejhammar
ecdbf0e42e Add Sharness as a submodule 2023-03-24 17:22:23 +01:00
Felipe Contreras
9754a9f3f6 Trivial simplification
Just return the values directly, no need to store them into variables.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
d2f11bd619 Remove multiple parent logic for file changes
This is already what repo.status does.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
3582221efd Compare changes only with the first parent
It's not necessary to check both parents.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
0ae0d20496 Remove no-op check
This code is only executed when there's two parents.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
e09a14a266 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>
2023-03-14 22:12:50 -06:00
Felipe Contreras
9df2f97f6c Rename variables in get_filechanges
It's easier to understand this way.

No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
531fa9b3a2 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>
2023-03-14 22:12:50 -06:00
Felipe Contreras
a229b39d66 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>
2023-03-14 22:12:50 -06:00
Felipe Contreras
c666fd9c95 Trivial style cleanup
Checking the array directly is more idiomatic.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
21fa443b4a Simplify list of files for the first commit
We already have the files.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-14 22:12:50 -06:00
Felipe Contreras
fd6ba361c6 github: enable tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-13 20:18:29 -06:00
Felipe Contreras
153ba2a5c1 Add main test
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-13 20:18:29 -06:00
Frej Drejhammar
df5278f755 Merge branch 'PR/297'
Closes #297
2023-03-13 17:57:20 +01:00
Felipe Contreras
6fbe4d0ad0 Skip earlier
Now that we have ctx easily available, skip early.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-10 12:38:42 -06:00
Felipe Contreras
fa73d8dec9 Share the changectx more
It's used everywhere, might as well pass it along.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-10 12:38:30 -06:00
Felipe Contreras
e1e15b2091 Avoid revsymbol()
We can just do repo[rev].

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Felipe Contreras
534d2bdd92 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>
2023-03-09 19:48:44 -06:00
Felipe Contreras
23f41c0ff1 Use revision directly instead of revnode
We don't need the revnode.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Felipe Contreras
8b1fd408ca 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>
2023-03-09 19:48:44 -06:00
Felipe Contreras
4a4d242e98 Fetch node directly
No need to call get_changeset() for that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Felipe Contreras
432254100b Fetch branch names directly
No need to use get_changeset() for just one thing.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Felipe Contreras
5e4bc6eb03 Remove cruft
Nothing uses that variable.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Felipe Contreras
7886016978 hg2git: set proper default branch
So that cfg_master is picked up in get_branch().

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-09 19:48:44 -06:00
Frej Drejhammar
18577f559d Merge branch 'PR/296' 2023-03-04 20:21:29 +01:00
Felipe Contreras
88defe7fd1 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>
2023-03-04 09:53:25 -06:00
Frej Drejhammar
4edea927fb Merge branch 'PR/295'
Closes 295
2023-03-04 16:12:26 +01:00
Felipe Contreras
bbab981130 Trivial simplification of wr
No need to issue two write commands.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-04 16:08:45 +01:00
Felipe Contreras
c3cbf1e04d Add wr_data helper
No functional changes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2023-03-03 19:34:29 -06:00
Felipe Contreras
4c10270302 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>
2023-03-03 19:33:45 -06:00