Mercurial > hg > mercurial-crew-with-dirclash
view hgext/convert/common.py @ 5045:f191bc3916f7
merge: do early copy to deal with issue636
Without copies/renames, merges source names are 1:1 with their
targets. Copies and renames introduce the possibility that there will
be two merges with the same input but different output. By doing the
copy to the destination name before the merge, the actual merge
becomes 1:1 again, and no source is the input to two different merges.
- add a preliminary scan to applyupdates to do copies
- for the merge action, pass the old name (for finding ancestors) and
the new name (for input to the merge) to filemerge
- eliminate the old post-merge copy
- lookup file contents from new name in filemerge
- pass new name to external merge helper
- report merge failure at new name
- add a test
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 01 Aug 2007 12:33:12 -0500 |
parents | 80fb4ec512b5 |
children | 20ec5cc02f18 |
line wrap: on
line source
# common code for the convert extension class NoRepo(Exception): pass class commit(object): def __init__(self, **parts): for x in "author date desc parents".split(): if not x in parts: raise util.Abort("commit missing field %s" % x) self.__dict__.update(parts) class converter_source(object): """Conversion source interface""" def __init__(self, ui, path): """Initialize conversion source (or raise NoRepo("message") exception if path is not a valid repository)""" raise NotImplementedError() def getheads(self): """Return a list of this repository's heads""" raise NotImplementedError() def getfile(self, name, rev): """Return file contents as a string""" raise NotImplementedError() def getmode(self, name, rev): """Return file mode, eg. '', 'x', or 'l'""" raise NotImplementedError() def getchanges(self, version): """Return sorted list of (filename, id) tuples for all files changed in rev. id just tells us which revision to return in getfile(), e.g. in git it's an object hash.""" raise NotImplementedError() def getcommit(self, version): """Return the commit object for version""" raise NotImplementedError() def gettags(self): """Return the tags as a dictionary of name: revision""" raise NotImplementedError() class converter_sink(object): """Conversion sink (target) interface""" def __init__(self, ui, path): """Initialize conversion sink (or raise NoRepo("message") exception if path is not a valid repository)""" raise NotImplementedError() def getheads(self): """Return a list of this repository's heads""" raise NotImplementedError() def mapfile(self): """Path to a file that will contain lines source_rev_id sink_rev_id mapping equivalent revision identifiers for each system.""" raise NotImplementedError() def authorfile(self): """Path to a file that will contain lines srcauthor=dstauthor mapping equivalent authors identifiers for each system.""" return None def putfile(self, f, e, data): """Put file for next putcommit(). f: path to file e: '', 'x', or 'l' (regular file, executable, or symlink) data: file contents""" raise NotImplementedError() def delfile(self, f): """Delete file for next putcommit(). f: path to file""" raise NotImplementedError() def putcommit(self, files, parents, commit): """Create a revision with all changed files listed in 'files' and having listed parents. 'commit' is a commit object containing at a minimum the author, date, and message for this changeset. Called after putfile() and delfile() calls. Note that the sink repository is not told to update itself to a particular revision (or even what that revision would be) before it receives the file data.""" raise NotImplementedError() def puttags(self, tags): """Put tags into sink. tags: {tagname: sink_rev_id, ...}""" raise NotImplementedError()