Skip to content
Snippets Groups Projects
Commit 78b15ad2 authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

convert: backout 81cf597dafa9 and a3545c3104aa -closemap

Closemap solves a very specific use case. It would be better to have a more
generic solution than to have to maintain this forever.

Closemap has not been released yet and removing it now will not break any
backward compatibility contract.

There is no test coverage for closemap but it seems like the same can be
achieved with a simple and much more powerful custom extension:

import hgext.convert.hg
class source(hgext.convert.hg.mercurial_source):
    def getcommit(self, rev):
        c = super(source, self).getcommit(rev)
        if rev in ['''
d643f67092ff123f6a192d52f12e7d123dae229f
9117c6561b0b
f368a1c302d5
''']:
            c.extra = c.extra.copy()
            c.extra['close'] = '1'
        return c
hgext.convert.hg.mercurial_source = source
parent 5236c7a7
No related branches found
No related tags found
No related merge requests found
......@@ -142,10 +142,6 @@
branch names. This can be used to (for instance) move code in one
repository from "default" to a named branch.
The closemap is a file that allows closing of a branch. This is useful if
you want to close a branch. Each entry contains a revision or hash
separated by white space.
Mercurial Source
################
......@@ -324,8 +320,6 @@
_('splice synthesized history into place'), _('FILE')),
('', 'branchmap', '',
_('change branch names while converting'), _('FILE')),
('', 'closemap', '',
_('closes given revs'), _('FILE')),
('', 'branchsort', None, _('try to sort changesets by branches')),
('', 'datesort', None, _('try to sort changesets by date')),
('', 'sourcesort', None, _('preserve source changesets order')),
......
......@@ -120,42 +120,6 @@
self.splicemap = self.parsesplicemap(opts.get('splicemap'))
self.branchmap = mapfile(ui, opts.get('branchmap'))
self.closemap = self.parseclosemap(opts.get('closemap'))
def parseclosemap(self, path):
""" check and validate the closemap format and
return a list of revs to close.
Format checking has two parts.
1. generic format which is same across all source types
2. specific format checking which may be different for
different source type. This logic is implemented in
checkrevformat function in source files like
hg.py, subversion.py etc.
"""
if not path:
return []
m = []
try:
fp = open(path, 'r')
for i, line in enumerate(fp):
line = line.splitlines()[0].rstrip()
if not line:
# Ignore blank lines
continue
# split line
lex = shlex.shlex(line, posix=True)
lex.whitespace_split = True
lex.whitespace += ','
line = list(lex)
for part in line:
self.source.checkrevformat(part, 'closemap')
m.extend(line)
# if file does not exist or error reading, exit
except IOError:
raise util.Abort(_('closemap file not found or error reading %s:')
% path)
return m
def parsesplicemap(self, path):
""" check and validate the splicemap format and
......@@ -444,9 +408,6 @@
except KeyError:
parents = [b[0] for b in pbranches]
source = progresssource(self.ui, self.source, len(files))
if self.closemap and rev in self.closemap:
commit.extra['close'] = 1
newnode = self.dest.putcommit(files, copies, parents, commit,
source, self.map)
source.close()
......
......@@ -122,10 +122,6 @@
can be used to (for instance) move code in one repository from "default"
to a named branch.
The closemap is a file that allows closing of a branch. This is useful if
you want to close a branch. Each entry contains a revision or hash
separated by white space.
Mercurial Source
################
......@@ -271,7 +267,6 @@
--filemap FILE remap file names using contents of file
--splicemap FILE splice synthesized history into place
--branchmap FILE change branch names while converting
--closemap FILE closes given revs
--branchsort try to sort changesets by branches
--datesort try to sort changesets by date
--sourcesort preserve source changesets order
......
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