Skip to content
Snippets Groups Projects
Commit 173e738d0da4 authored by Scott Chacon's avatar Scott Chacon
Browse files

remote management tools

parent f0daee676e10
No related branches found
No related tags found
No related merge requests found
GENERAL
==========
* remote management
* submodules?
* switch object mapping to hg->git since the many to one is that direction
* file modes
......@@ -10,15 +9,9 @@
PUSH
==========
* get a list of all the hg changesets not yet mapped
* create git objects from each changeset (incl trees/blobs)
- add metadata to commits (branch names, explicit file names)
* update mapfile with new changeset/commit mapping
* connect to server pushing to
- figure out needs (use heads/bookmarks for haves)
* create packfile with needed objects
- some delta compression if possible (?)
* upload packfile, remove temp packfile
* update 'remote' references after push confirmation
* push confirmation? is there extra data after the packfile upload?
* output something after process is complete
* convert tags to git
......
......@@ -44,6 +44,6 @@
node = git.remote_head('origin')
hg.update(dest_repo, node)
def gpush(ui, repo, remote_name='origin'):
def gpush(ui, repo, remote_name='origin', branch=None):
git = GitHandler(repo, ui)
git.push(remote_name)
......@@ -48,3 +48,24 @@
git = GitHandler(repo, ui)
git.push(remote_name)
def gremote(ui, repo, *args):
git = GitHandler(repo, ui)
if len(args) == 0:
git.remote_list()
else:
verb = args[0]
nick = args[1]
if verb == 'add':
if args[2]:
git.remote_add(nick, args[2])
else:
repo.ui.warn(_("must supply a url to add as a remote\n"))
elif verb == 'rm':
git.remote_remove(nick)
elif verb == 'show':
git.remote_show(nick)
else:
repo.ui.warn(_("unrecognized command to gremote\n"))
......@@ -50,7 +71,7 @@
def gpull(ui, repo):
def gfetch(ui, repo):
dest_repo.ui.status(_("pulling from git url\n"))
commands.norepo += " gclone"
cmdtable = {
"gclone":
......@@ -52,12 +73,10 @@
dest_repo.ui.status(_("pulling from git url\n"))
commands.norepo += " gclone"
cmdtable = {
"gclone":
(gclone,
[ #('A', 'authors', '', 'username mapping filename'),
],
'Clone a git repository into an hg repository.',
(gclone, [],
_('Clone a git repository into an hg repository.'),
),
"gpush":
(gpush, [], _('hg gpush remote')),
......@@ -61,8 +80,10 @@
),
"gpush":
(gpush, [], _('hg gpush remote')),
"gpull":
(gpull,
[('m', 'merge', None, _('merge automatically'))],
_('hg gpull [--merge] remote')),
"gfetch":
(gfetch, [],
#[('m', 'merge', None, _('merge automatically'))],
_('hg gfetch remote')),
"gremote":
(gremote, [], _('hg gremote add remote (url)')),
}
......@@ -124,8 +124,7 @@
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
self.save_config()
......@@ -128,7 +127,27 @@
def remote_add(self, remote_name, git_url):
self._config['remote.' + remote_name + '.url'] = git_url
self.save_config()
def remote_remove(self, remote_name):
key = 'remote.' + remote_name + '.url'
if key in self._config:
del self._config[key]
self.save_config()
def remote_show(self, remote_name):
key = 'remote.' + remote_name + '.url'
if key in self._config:
name = self._config[key]
print "URL for " + remote_name + " : " + name
else:
print "No remote named : " + remote_name
return
def remote_list(self):
for key, value in self._config.iteritems():
if key[0:6] == 'remote':
print key + "\t" + value
def remote_name_to_url(self, remote_name):
return self._config['remote.' + remote_name + '.url']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment