Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
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
Environments
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
mercurial-devel
Commits
a7492fb2107b
Commit
a7492fb2107b
authored
16 years ago
by
Patrick Mezard
Browse files
Options
Downloads
Patches
Plain Diff
convert: fix svn branch source detection corner case
It was confused by composite-looking revisions made by copy + remove.
parent
3447c088a516
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hgext/convert/subversion.py
+19
-1
19 additions, 1 deletion
hgext/convert/subversion.py
tests/test-convert-svn-branches.out
+2
-2
2 additions, 2 deletions
tests/test-convert-svn-branches.out
with
21 additions
and
3 deletions
hgext/convert/subversion.py
+
19
−
1
View file @
a7492fb2
...
...
@@ -709,6 +709,13 @@
from_revnum
,
to_revnum
=
to_revnum
,
from_revnum
self
.
child_cset
=
None
def
isdescendantof
(
parent
,
child
):
if
not
child
or
not
parent
or
not
child
.
startswith
(
parent
):
return
False
subpath
=
child
[
len
(
parent
):]
return
len
(
subpath
)
>
1
and
subpath
[
0
]
==
'
/
'
def
parselogentry
(
orig_paths
,
revnum
,
author
,
date
,
message
):
"""
Return the parsed commit object or None, and True if
the revision is a branch root.
...
...
@@ -732,6 +739,17 @@
if
root_paths
:
path
,
ent
=
root_paths
[
-
1
]
if
ent
.
copyfrom_path
:
# If dir was moved while one of its file was removed
# the log may look like:
# A /dir (from /dir:x)
# A /dir/a (from /dir/a:y)
# A /dir/b (from /dir/b:z)
# ...
# for all remaining children.
# Let's take the highest child element from rev as source.
copies
=
[(
p
,
e
)
for
p
,
e
in
orig_paths
[:
-
1
]
if
isdescendantof
(
ent
.
copyfrom_path
,
e
.
copyfrom_path
)]
fromrev
=
max
([
e
.
copyfrom_rev
for
p
,
e
in
copies
]
+
[
ent
.
copyfrom_rev
])
branched
=
True
newpath
=
ent
.
copyfrom_path
+
self
.
module
[
len
(
path
):]
# ent.copyfrom_rev may not be the actual last revision
...
...
@@ -735,7 +753,7 @@
branched
=
True
newpath
=
ent
.
copyfrom_path
+
self
.
module
[
len
(
path
):]
# ent.copyfrom_rev may not be the actual last revision
previd
=
self
.
latest
(
newpath
,
ent
.
copy
from
_
rev
)
previd
=
self
.
latest
(
newpath
,
fromrev
)
if
previd
is
not
None
:
prevmodule
,
prevnum
=
self
.
revsplit
(
previd
)[
1
:]
if
prevnum
>=
self
.
startrev
:
...
...
This diff is collapsed.
Click to expand it.
tests/test-convert-svn-branches.out
+
2
−
2
View file @
a7492fb2
...
...
@@ -117,8 +117,8 @@
| | |
| o | branch= 3 change a files: a
| | |
+---
o branch=old 2 branch trunk, remove c files:
a b
| |
| |
o branch=old 2 branch trunk, remove c files:
| |
/
| o branch= 1 hello files: a b c
|/
o branch= 0 init projA files:
...
...
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