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
ace0f6ed
Commit
ace0f6ed
authored
15 years ago
by
Scott Chacon
Browse files
Options
Downloads
Patches
Plain Diff
setting up for upload-pack functionality
parent
58cd0512
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
__init__.py
+7
-7
7 additions, 7 deletions
__init__.py
git_handler.py
+13
-3
13 additions, 3 deletions
git_handler.py
with
20 additions
and
10 deletions
__init__.py
+
7
−
7
View file @
ace0f6ed
...
...
@@ -44,9 +44,9 @@
node
=
git
.
remote_head
(
'
origin
'
)
hg
.
update
(
dest_repo
,
node
)
def
gpush
(
ui
,
repo
,
remote_name
):
# determine new repo name
dest_repo
.
ui
.
status
(
_
(
"
pushing to git url
\n
"
)
)
def
gpush
(
ui
,
repo
,
remote_name
=
'
origin
'
):
git
=
GitHandler
(
repo
,
ui
)
git
.
push
(
remote_name
)
def
gpull
(
ui
,
repo
):
dest_repo
.
ui
.
status
(
_
(
"
pulling from git url
\n
"
))
...
...
@@ -60,7 +60,5 @@
'
Clone a git repository into an hg repository.
'
,
),
"
gpush
"
:
(
gpush
,
[(
'
m
'
,
'
merge
'
,
None
,
_
(
'
merge automatically
'
))],
_
(
'
hg gpush remote
'
)),
(
gpush
,
[],
_
(
'
hg gpush remote
'
)),
"
gpull
"
:
...
...
@@ -66,3 +64,5 @@
"
gpull
"
:
(
gpull
,
[],
_
(
'
hg gpull [--merge] remote
'
)),
(
gpull
,
[(
'
m
'
,
'
merge
'
,
None
,
_
(
'
merge automatically
'
))],
_
(
'
hg gpull [--merge] remote
'
)),
}
This diff is collapsed.
Click to expand it.
git_handler.py
+
13
−
3
View file @
ace0f6ed
...
...
@@ -18,4 +18,5 @@
self
.
load_map
()
self
.
load_config
()
# make the git data directory
def
init_if_missing
(
self
):
...
...
@@ -21,3 +22,2 @@
def
init_if_missing
(
self
):
# make the git data directory
git_hg_path
=
os
.
path
.
join
(
self
.
repo
.
path
,
'
git
'
)
...
...
@@ -23,6 +23,7 @@
git_hg_path
=
os
.
path
.
join
(
self
.
repo
.
path
,
'
git
'
)
os
.
mkdir
(
git_hg_path
)
dulwich
.
repo
.
Repo
.
init_bare
(
git_hg_path
)
if
not
os
.
path
.
exists
(
git_hg_path
):
os
.
mkdir
(
git_hg_path
)
dulwich
.
repo
.
Repo
.
init_bare
(
git_hg_path
)
def
load_git
(
self
):
git_dir
=
os
.
path
.
join
(
self
.
repo
.
path
,
'
git
'
)
...
...
@@ -66,6 +67,12 @@
self
.
import_git_objects
(
remote_name
)
self
.
save_map
()
def
push
(
self
,
remote_name
):
self
.
ui
.
status
(
_
(
"
pushing to :
"
+
remote_name
+
"
\n
"
))
self
.
export_git_objects
()
self
.
upload_pack
(
remote_name
)
self
.
save_map
()
# TODO: make these actually save and recall
def
remote_add
(
self
,
remote_name
,
git_url
):
self
.
_config
[
'
remote.
'
+
remote_name
+
'
.url
'
]
=
git_url
...
...
@@ -79,6 +86,9 @@
if
head
==
'
HEAD
'
:
return
self
.
_map
[
sha
]
return
None
def
upload_pack
(
self
,
remote_name
):
self
.
ui
.
status
(
_
(
"
upload pack
\n
"
))
def
fetch_pack
(
self
,
remote_name
):
git_url
=
self
.
remote_name_to_url
(
remote_name
)
...
...
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