mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
updated tip to sverres code
This commit is contained in:
commit
d1e1396052
@ -57,6 +57,8 @@ class GitHandler(object):
|
|||||||
else:
|
else:
|
||||||
self.gitdir = self.repo.join('git')
|
self.gitdir = self.repo.join('git')
|
||||||
|
|
||||||
|
self.importbranch = ui.config('git', 'importbranch')
|
||||||
|
|
||||||
self.init_if_missing()
|
self.init_if_missing()
|
||||||
self.load_git()
|
self.load_git()
|
||||||
self.load_map()
|
self.load_map()
|
||||||
@ -195,7 +197,7 @@ class GitHandler(object):
|
|||||||
return dict(filter(is_local_head, refs.items()))
|
return dict(filter(is_local_head, refs.items()))
|
||||||
|
|
||||||
def export_git_objects(self):
|
def export_git_objects(self):
|
||||||
self.ui.status(_("exporting git objects\n"))
|
self.ui.status(_("importing Hg objects into Git\n"))
|
||||||
total = len(self.repo.changelog)
|
total = len(self.repo.changelog)
|
||||||
magnitude = int(math.log(total, 10)) + 1 if total else 1
|
magnitude = int(math.log(total, 10)) + 1 if total else 1
|
||||||
for i, rev in enumerate(self.repo.changelog):
|
for i, rev in enumerate(self.repo.changelog):
|
||||||
@ -247,8 +249,11 @@ class GitHandler(object):
|
|||||||
if 'committer' in extra:
|
if 'committer' in extra:
|
||||||
# fixup timezone
|
# fixup timezone
|
||||||
(name_timestamp, timezone) = extra['committer'].rsplit(' ', 1)
|
(name_timestamp, timezone) = extra['committer'].rsplit(' ', 1)
|
||||||
|
try:
|
||||||
timezone = format_timezone(-int(timezone))
|
timezone = format_timezone(-int(timezone))
|
||||||
commit['committer'] = '%s %s' % (name_timestamp, timezone)
|
commit['committer'] = '%s %s' % (name_timestamp, timezone)
|
||||||
|
except ValueError:
|
||||||
|
self.ui.warn(_("Ignoring committer in extra, invalid timezone in r%s: '%s'.\n") % (rev, timezone))
|
||||||
if 'encoding' in extra:
|
if 'encoding' in extra:
|
||||||
commit['encoding'] = extra['encoding']
|
commit['encoding'] = extra['encoding']
|
||||||
|
|
||||||
@ -491,6 +496,9 @@ class GitHandler(object):
|
|||||||
|
|
||||||
if remote_name:
|
if remote_name:
|
||||||
todo = self.git.remote_refs(remote_name).values()[:]
|
todo = self.git.remote_refs(remote_name).values()[:]
|
||||||
|
elif self.importbranch:
|
||||||
|
branches = self.importbranch.split(',')
|
||||||
|
todo = [self.git.ref(i.strip()) for i in branches]
|
||||||
else:
|
else:
|
||||||
todo = self.git.heads().values()[:]
|
todo = self.git.heads().values()[:]
|
||||||
|
|
||||||
@ -523,6 +531,7 @@ class GitHandler(object):
|
|||||||
else:
|
else:
|
||||||
self.pseudo_import_git_commit(commit)
|
self.pseudo_import_git_commit(commit)
|
||||||
|
|
||||||
|
if remote_name:
|
||||||
self.update_hg_bookmarks(remote_name)
|
self.update_hg_bookmarks(remote_name)
|
||||||
|
|
||||||
def update_hg_bookmarks(self, remote_name):
|
def update_hg_bookmarks(self, remote_name):
|
||||||
|
Loading…
Reference in New Issue
Block a user