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
36e94e805fa7
Commit
36e94e805fa7
authored
15 years ago
by
Scott Chacon
Browse files
Options
Downloads
Patches
Plain Diff
added basic config file for remembering remote urls
parent
01f28d40cb6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
TODO.txt
+15
-16
15 additions, 16 deletions
TODO.txt
__init__.py
+1
-1
1 addition, 1 deletion
__init__.py
git_handler.py
+23
-3
23 additions, 3 deletions
git_handler.py
with
39 additions
and
20 deletions
TODO.txt
+
15
−
16
View file @
36e94e80
CLONE
===========
* only try to import non-mapped commits
* checkout the HEAD
* limit to HEAD branch? (gh-pages makes weird import)
- possibly also add bookmarks on the same development line
GENERAL
==========
...
...
@@ -8,13 +3,5 @@
* strip or close branches that have been abandoned (?)
* tag conversion
FETCH
===========
* gfetch command
* some sort of remote management
* remote management
PUSH
==========
...
...
@@ -30,3 +17,15 @@
* upload packfile, remove temp packfile
* convert tags to git
CLONE
===========
* tag conversion
FETCH
===========
* gfetch command
* only try to import non-mapped commits
* strip or close branches that have been abandoned (?)
This diff is collapsed.
Click to expand it.
__init__.py
+
1
−
1
View file @
36e94e80
...
...
@@ -49,7 +49,7 @@
node
=
git
.
remote_head
(
'
origin
'
)
hg
.
update
(
dest_repo
,
node
)
def
gpush
(
ui
,
repo
):
def
gpush
(
ui
,
repo
,
remote_name
):
dest_repo
.
ui
.
status
(
_
(
"
pushing to git url
\n
"
))
def
gpull
(
ui
,
repo
):
...
...
This diff is collapsed.
Click to expand it.
git_handler.py
+
23
−
3
View file @
36e94e80
...
...
@@ -15,8 +15,9 @@
self
.
ui
=
ui
self
.
load_git
()
self
.
load_map
()
self
.
load_config
()
def
load_git
(
self
):
git_dir
=
os
.
path
.
join
(
self
.
repo
.
path
,
'
git
'
)
self
.
git
=
Repo
(
git_dir
)
...
...
@@ -18,11 +19,13 @@
def
load_git
(
self
):
git_dir
=
os
.
path
.
join
(
self
.
repo
.
path
,
'
git
'
)
self
.
git
=
Repo
(
git_dir
)
## FILE LOAD AND SAVE METHODS
def
load_map
(
self
):
self
.
_map
=
{}
if
os
.
path
.
exists
(
self
.
repo
.
join
(
'
git-mapfile
'
)):
for
line
in
self
.
repo
.
opener
(
'
git-mapfile
'
):
gitsha
,
hgsha
=
line
.
strip
().
split
(
'
'
,
1
)
self
.
_map
[
gitsha
]
=
hgsha
...
...
@@ -23,12 +26,12 @@
def
load_map
(
self
):
self
.
_map
=
{}
if
os
.
path
.
exists
(
self
.
repo
.
join
(
'
git-mapfile
'
)):
for
line
in
self
.
repo
.
opener
(
'
git-mapfile
'
):
gitsha
,
hgsha
=
line
.
strip
().
split
(
'
'
,
1
)
self
.
_map
[
gitsha
]
=
hgsha
def
save_map
(
self
):
file
=
self
.
repo
.
opener
(
'
git-mapfile
'
,
'
w+
'
)
for
gitsha
,
hgsha
in
self
.
_map
.
iteritems
():
file
.
write
(
"
%s %s
\n
"
%
(
gitsha
,
hgsha
))
file
.
close
()
...
...
@@ -30,8 +33,24 @@
def
save_map
(
self
):
file
=
self
.
repo
.
opener
(
'
git-mapfile
'
,
'
w+
'
)
for
gitsha
,
hgsha
in
self
.
_map
.
iteritems
():
file
.
write
(
"
%s %s
\n
"
%
(
gitsha
,
hgsha
))
file
.
close
()
def
load_config
(
self
):
self
.
_config
=
{}
if
os
.
path
.
exists
(
self
.
repo
.
join
(
'
git-config
'
)):
for
line
in
self
.
repo
.
opener
(
'
git-config
'
):
key
,
value
=
line
.
strip
().
split
(
'
'
,
1
)
self
.
_config
[
key
]
=
value
def
save_config
(
self
):
file
=
self
.
repo
.
opener
(
'
git-config
'
,
'
w+
'
)
for
key
,
value
in
self
.
_config
.
iteritems
():
file
.
write
(
"
%s %s
\n
"
%
(
key
,
value
))
file
.
close
()
## END FILE LOAD AND SAVE METHODS
def
fetch
(
self
,
remote_name
):
self
.
ui
.
status
(
_
(
"
fetching from :
"
+
remote_name
+
"
\n
"
))
...
...
@@ -42,6 +61,7 @@
# TODO: make these actually save and recall
def
remote_add
(
self
,
remote_name
,
git_url
):
self
.
_git_url
=
git_url
self
.
_config
[
'
remote.
'
+
remote_name
+
'
.url
'
]
=
git_url
self
.
save_config
()
def
remote_name_to_url
(
self
,
remote_name
):
...
...
@@ -46,6 +66,6 @@
def
remote_name_to_url
(
self
,
remote_name
):
return
self
.
_
git_
url
return
self
.
_
config
[
'
remote.
'
+
remote_name
+
'
.
url
'
]
def
remote_head
(
self
,
remote_name
):
for
head
,
sha
in
self
.
git
.
remote_refs
(
remote_name
).
iteritems
():
...
...
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