Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
hg-git
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mercurial
hg-git
Commits
7aec15c8f9f1
Commit
2be33603
authored
Aug 07, 2020
by
Manuel Jacob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overlay: support {gitnode} keyword in templates for incoming changes
Fixes
#239
.
parent
9e47dd1088ef
Pipeline
#13017
passed with stages
in 3 minutes and 21 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
hggit/overlay.py
hggit/overlay.py
+18
-0
tests/test-incoming.t
tests/test-incoming.t
+3
-5
No files found.
hggit/overlay.py
View file @
7aec15c8f9f1
...
...
@@ -12,6 +12,7 @@ from mercurial import (
context
,
manifest
,
match
as
matchmod
,
node
,
util
,
)
from
mercurial.node
import
bin
,
hex
,
nullid
...
...
@@ -438,6 +439,21 @@ class overlaychangelog(overlayrevlog):
)
class
overlaygithandler
(
object
):
# This was added to support the {gitnode} keyword in templates for incoming.
# For this, falling back to the underlying repository is not necessary.
def
__init__
(
self
,
repo
):
self
.
repo
=
repo
def
map_git_get
(
self
,
sha
):
# Normally, the parameter contains the hg hash. However, for incoming
# changesets, it contains the git hash, so we can return it as-is
# (after sanity-checking that it is the hash of an incoming commit).
assert
node
.
bin
(
sha
)
in
self
.
repo
.
revmap
return
sha
class
overlayrepo
(
object
):
def
__init__
(
self
,
handler
,
commits
,
refs
):
self
.
handler
=
handler
...
...
@@ -472,6 +488,8 @@ class overlayrepo(object):
except
(
AttributeError
,
ImportError
):
pass
self
.
githandler
=
overlaygithandler
(
self
)
def
_constructmanifest
(
self
):
return
overlaymanifestrevlog
(
self
,
self
.
handler
.
repo
.
_constructmanifest
())
...
...
tests/test-incoming.t
View file @
7aec15c8f9f1
...
...
@@ -95,12 +95,10 @@ Load commonly used test logic
+
gamma
2
incoming
with
a
template
that
uses
gitnode
shows
no
git
hash
,
but
does
not
crash
$
hg
incoming
-
r
master
--
template
'
changeset {rev}:{node|short}\ngitnode {gitnode}\n
'
|
grep
-
v
'
no changes found
'
$
hg
incoming
-
r
master
--
template
'
changeset: {rev}:{node|short}\ngitnode: {gitnode}\n
'
|
grep
-
v
'
no changes found
'
comparing
with
$TESTTMP
/
gitrepo
changeset
1
:
9497
a4ee62e1
gitnode
changeset:
1
:
9497
a4ee62e1
gitnode:
9497
a4ee62e16ee641860d7677cdb2589ea15554
incoming
-
r
$
hg
incoming
-
r
master
|
grep
-
v
'
no changes found
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment