Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hg-git
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
hg-git
Commits
c2c2a8bdcce3
Commit
c2c2a8bdcce3
authored
3 years ago
by
Dan Villiom Podlaski Christiansen
Browse files
Options
Downloads
Patches
Plain Diff
tests: better transaction checks
parent
c019866205f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!124
Adjust initial clone and push behaviour
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test-transactions.t
+49
-20
49 additions, 20 deletions
tests/test-transactions.t
with
49 additions
and
20 deletions
tests/test-transactions.t
+
49
−
20
View file @
c2c2a8bd
...
@@ -101,6 +101,6 @@
...
@@ -101,6 +101,6 @@
10
10
$
rm
-
rf
hgrepo
$
rm
-
rf
hgrepo
Interruptions
The
user
experience
-------------
-------------
------
...
@@ -106,3 +106,4 @@
...
@@ -106,3 +106,4 @@
How
does
hg
-
git
behave
if
a
conversion
fails
or
is
interrupted
?
The
map
save
interval
affects
how
and
when
changes
are
reported
to
the
user
.
...
@@ -108,5 +109,5 @@
...
@@ -108,5 +109,5 @@
Ideally
,
we
would
always
save
t
he
re
sults
of
whatever
happened
First
,
create
a
repository
,
set
up
to
pull
from
git
,
and
w
here
we
can
interrupt
the
conversion
.
$
hg
init
hgrepo
$
hg
init
hgrepo
$
cat
>>
hgrepo
/.hg/
hgrc
<<
EOF
$
cat
>>
hgrepo
/.hg/
hgrc
<<
EOF
...
@@ -115,6 +116,42 @@
...
@@ -115,6 +116,42 @@
>
EOF
>
EOF
$
cd
hgrepo
$
cd
hgrepo
A
low
save
interval
causes
a
lot
of
reports:
$
hg
--
config
hggit
.
mapsavefrequency
=
25
pull
pulling
from
$TESTTMP
/
gitrepo
importing
git
objects
into
hg
(
run
'
hg update
'
to
get
a
working
copy
)
Reset
the
repository
$
hg
strip
--
no
-
backup
'
all()
'
$
hg
gclear
clearing
out
the
git
cache
data
And
with
phases
?
We
currently
don
'
t publish changes during the
conversion, so the user will see a large batch at the end:
$ hg --config hggit.mapsavefrequency=25 --config hggit.usephases=yes pull
pulling from $TESTTMP/gitrepo
importing git objects into hg
(run
'
hg
update
'
to get a working copy)
Reset the repository
$ hg strip --no-backup
'
all
()'
$ hg gclear
clearing out the git cache data
Interruptions
-------------
How does hg-git behave if a conversion fails or is interrupted?
Ideally, we would always save the results of whatever happened, but
that causes a significant slowdown. Transactions are an important
optimisation within Mercurial.
Test an error in a pull:
Test an error in a pull:
$ ABORT_AFTER=99 hg pull
$ ABORT_AFTER=99 hg pull
...
@@ -126,5 +163,5 @@
...
@@ -126,5 +163,5 @@
[255]
[255]
$ hg log -l 10 -T
'{
rev
}
{
gitnode
}
\
n
'
$ hg log -l 10 -T
'{
rev
}
{
gitnode
}
\
n
'
How
does
map
save
interval
work
?
Test the user exiting in the first transaction:
...
@@ -130,5 +167,5 @@
...
@@ -130,5 +167,5 @@
$
EXIT_AFTER
=
1
5
hg
--
config
hggit
.
mapsavefrequency
=
10
pull
$ EXIT_AFTER=5 hg --config hggit.mapsavefrequency=10 pull
pulling from $TESTTMP/gitrepo
pulling from $TESTTMP/gitrepo
importing git objects into hg
importing git objects into hg
transaction abort!
transaction abort!
...
@@ -136,14 +173,6 @@
...
@@ -136,14 +173,6 @@
interrupted!
interrupted!
[255]
[255]
$ hg log -l 10 -T
'{
rev
}
{
gitnode
}
\
n
'
$ hg log -l 10 -T
'{
rev
}
{
gitnode
}
\
n
'
9
7
cbb16ec981b308e1e2b181f8e1f22c8f409f44e
8
42
da70ed92bbecf9f348ba59c93646be723d0bf2
Check that we have no state, but clear it just in case
7
17e841146
e5744b81af9959634d82c20a5d7df52
6
c31065bf97bf014815e37cdfbdef2c32c687f314
5
fcf21b8e0520ec1cced1d7593d13f9ee54721269
4
46
acd02d0352e4b92bd6a099bb0490305d847a18
3
61
eeda444b37b8aa3892d5f04c66c5441d21dd66
2
e55db11bb0472791c7af3fc636772174cdea4a36
1
17
a2672b3c24c02d568f99d8d55ccae2bf362d5c
0
4e195
b4c6e77604b70a8ad3b01306adbb9b1c7e7
...
@@ -149,7 +178,6 @@
...
@@ -149,7 +178,6 @@
Reset
the
repository
$ ls -d .hg/git*
.hg/git
$
hg
strip
--
no
-
backup
'
all()
'
$ hg gclear
$ hg gclear
clearing out the git cache data
clearing out the git cache data
...
@@ -153,7 +181,8 @@
...
@@ -153,7 +181,8 @@
$ hg gclear
$ hg gclear
clearing out the git cache data
clearing out the git cache data
Test
the
user
exiting
in
the
middle
of
a
conversion:
Test the user exiting in the middle of a conversion, after the first
transaction:
$ EXIT_AFTER=15 hg --config hggit.mapsavefrequency=10 pull
$ EXIT_AFTER=15 hg --config hggit.mapsavefrequency=10 pull
pulling from $TESTTMP/gitrepo
pulling from $TESTTMP/gitrepo
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment