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
11ca2182
Commit
11ca2182
authored
9 years ago
by
Siddharth Agarwal
Browse files
Options
Downloads
Patches
Plain Diff
overlay: adapt diff to work with lazymanifests
parent
5cc2ad8a
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
hggit/__init__.py
+7
-0
7 additions, 0 deletions
hggit/__init__.py
hggit/overlay.py
+20
-2
20 additions, 2 deletions
hggit/overlay.py
with
27 additions
and
2 deletions
hggit/__init__.py
+
7
−
0
View file @
11ca2182
...
...
@@ -36,6 +36,7 @@
from
mercurial
import
hg
from
mercurial
import
ignore
from
mercurial
import
localrepo
from
mercurial
import
manifest
from
mercurial.node
import
hex
from
mercurial
import
revset
from
mercurial
import
scmutil
...
...
@@ -45,6 +46,7 @@
import
gitrepo
import
hgrepo
import
overlay
import
util
from
git_handler
import
GitHandler
import
verify
...
...
@@ -126,6 +128,11 @@
klass
=
hgrepo
.
generate_repo_subclass
(
repo
.
__class__
)
repo
.
__class__
=
klass
if
hgutil
.
safehasattr
(
manifest
,
'
_lazymanifest
'
):
# Mercurial >= 3.4
extensions
.
wrapfunction
(
manifest
.
manifestdict
,
'
diff
'
,
overlay
.
wrapmanifestdictdiff
)
@command
(
'
gimport
'
)
def
gimport
(
ui
,
repo
,
remote_name
=
None
):
'''
import commits from Git to Mercurial
'''
...
...
This diff is collapsed.
Click to expand it.
hggit/overlay.py
+
20
−
2
View file @
11ca2182
...
...
@@ -103,6 +103,12 @@
# below code copied from manifest.py:manifestdict.diff
diff
=
{}
try
:
m2flagget
=
m2
.
flags
except
AttributeError
:
# Mercurial <= 3.3
m2flagget
=
m2
.
_flags
.
get
for
fn
,
n1
in
self
.
iteritems
():
fl1
=
self
.
_flags
.
get
(
fn
,
''
)
n2
=
m2
.
get
(
fn
,
None
)
...
...
@@ -106,7 +112,7 @@
for
fn
,
n1
in
self
.
iteritems
():
fl1
=
self
.
_flags
.
get
(
fn
,
''
)
n2
=
m2
.
get
(
fn
,
None
)
fl2
=
m2
.
_
flag
s
.
get
(
fn
,
''
)
fl2
=
m2flagget
(
fn
,
''
)
if
n2
is
None
:
fl2
=
''
if
n1
!=
n2
or
fl1
!=
fl2
:
...
...
@@ -116,7 +122,7 @@
for
fn
,
n2
in
m2
.
iteritems
():
if
fn
not
in
self
:
fl2
=
m2
.
_
flag
s
.
get
(
fn
,
''
)
fl2
=
m2flagget
(
fn
,
''
)
diff
[
fn
]
=
((
None
,
''
),
(
n2
,
fl2
))
return
diff
...
...
@@ -124,6 +130,18 @@
def
__delitem__
(
self
,
path
):
del
self
.
_map
[
path
]
def
wrapmanifestdictdiff
(
orig
,
self
,
m2
,
clean
=
False
):
'''
avoid calling into lazymanifest code if m2 is an overlaymanifest
'''
if
isinstance
(
m2
,
overlaymanifest
):
diff
=
m2
.
diff
(
self
,
clean
=
clean
)
# since we calculated the diff with m2 vs m1, flip it around
for
fn
in
diff
:
c1
,
c2
=
diff
[
fn
]
diff
[
fn
]
=
c2
,
c1
return
diff
else
:
return
orig
(
self
,
m2
,
clean
=
clean
)
class
overlayfilectx
(
object
):
def
__init__
(
self
,
repo
,
path
,
fileid
=
None
):
self
.
repo
=
repo
...
...
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