##// END OF EJS Templates
tests: update test-devel-warnings.t output with chg...
tests: update test-devel-warnings.t output with chg The output change was caused by dc9901558e3c6a78bad3f6594b3888f95104c443.

File last commit:

r44937:9d2b2df2 default
r45103:54d5424d default
Show More
hg.py
729 lines | 24.6 KiB | text/x-python | PythonLexer
Martin Geisler
convert: add copyright and license headers to back-ends
r8250 # hg.py - hg backend for convert extension
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
Brendan Cully
Split convert extension into common and repository type modules
r4536
Bryan O'Sullivan
convert: some tidyups, doc improvements, and test fixes...
r5556 # Notes for hg->hg conversion:
#
# * Old versions of Mercurial didn't trim the whitespace from the ends
# of commit messages, but new versions do. Changesets created by
# those older versions, then converted, may thus have different
# hashes for changesets that are otherwise identical.
#
Patrick Mezard
convert/hg: update documentation
r8596 # * Using "--config convert.hg.saverev=true" will make the source
# identifier to be stored in the converted revision. This will cause
# the converted revision to have a different identity than the
# source.
timeless
convert: hg use absolute_import
r28370 from __future__ import absolute_import
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
timeless
convert: hg use absolute_import
r28370 import os
import re
import time
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Yuya Nishihara
py3: move up symbol imports to enforce import-checker rules...
r29205 from mercurial.i18n import _
Gregory Szorc
py3: manually import pycompat.open into files that need it...
r43355 from mercurial.pycompat import open
timeless
convert: hg use absolute_import
r28370 from mercurial import (
bookmarks,
context,
error,
exchange,
hg,
lock as lockmod,
merge as mergemod,
node as nodemod,
phases,
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 pycompat,
timeless
convert: hg use absolute_import
r28370 scmutil,
util,
)
Boris Feld
util: extract all date-related utils in utils/dateutil module...
r36625 from mercurial.utils import dateutil
Augie Fackler
formatting: blacken the codebase...
r43346
timeless
pycompat: switch to util.stringio for py3 compat
r28861 stringio = util.stringio
timeless
convert: hg use absolute_import
r28370 from . import common
Augie Fackler
formatting: blacken the codebase...
r43346
timeless
convert: hg use absolute_import
r28370 mapfile = common.mapfile
NoRepo = common.NoRepo
Brendan Cully
Split convert extension into common and repository type modules
r4536
Augie Fackler
convert: make hg sha1 regex consistently be a bytes...
r36151 sha1re = re.compile(br'\b[0-9a-f]{12,40}\b')
Sean Farley
convert: replace old sha1s in the description...
r20372
Augie Fackler
formatting: blacken the codebase...
r43346
timeless
convert: hg use absolute_import
r28370 class mercurial_sink(common.converter_sink):
Matt Harbison
convert: save an indicator of the repo type for sources and sinks...
r35168 def __init__(self, ui, repotype, path):
common.converter_sink.__init__(self, ui, repotype, path)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.branchnames = ui.configbool(b'convert', b'hg.usebranchnames')
self.clonebranches = ui.configbool(b'convert', b'hg.clonebranches')
self.tagsbranch = ui.config(b'convert', b'hg.tagsbranch')
Brendan Cully
convert: hg: optionally create branches as clones...
r5173 self.lastbranch = None
Bryan O'Sullivan
convert: refactor sink initialisation, to remove hardcoding of hg...
r5441 if os.path.isdir(path) and len(os.listdir(path)) > 0:
try:
self.repo = hg.repository(self.ui, path)
Patrick Mezard
convert: mercurial sink must be local
r5918 if not self.repo.local():
Augie Fackler
formatting: blacken the codebase...
r43346 raise NoRepo(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b'%s is not a local Mercurial repository') % path
Augie Fackler
formatting: blacken the codebase...
r43346 )
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except error.RepoError as err:
Matt Mackall
ui: print_exc() -> traceback()
r8206 ui.traceback()
Bryan O'Sullivan
convert: refactor sink initialisation, to remove hardcoding of hg...
r5441 raise NoRepo(err.args[0])
else:
try:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 ui.status(_(b'initializing destination %s repository\n') % path)
Bryan O'Sullivan
convert: refactor sink initialisation, to remove hardcoding of hg...
r5441 self.repo = hg.repository(self.ui, path, create=True)
Patrick Mezard
convert: mercurial sink must be local
r5918 if not self.repo.local():
Augie Fackler
formatting: blacken the codebase...
r43346 raise NoRepo(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b'%s is not a local Mercurial repository') % path
Augie Fackler
formatting: blacken the codebase...
r43346 )
Bryan O'Sullivan
convert: refactor sink initialisation, to remove hardcoding of hg...
r5441 self.created.append(path)
Peter Arrenbrecht
cleanup: drop unused assignments
r7875 except error.RepoError:
Matt Mackall
ui: print_exc() -> traceback()
r8206 ui.traceback()
Augie Fackler
formatting: blacken the codebase...
r43346 raise NoRepo(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b"could not create hg repository %s as sink") % path
Augie Fackler
formatting: blacken the codebase...
r43346 )
Bryan O'Sullivan
convert: acquire/release locks periodically
r5014 self.lock = None
self.wlock = None
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 self.filemapmode = False
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 self.subrevmaps = {}
Bryan O'Sullivan
convert: acquire/release locks periodically
r5014
def before(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.debug(b'run hg sink pre-conversion action\n')
Alexis S. L. Carvalho
convert: fix locking order
r5052 self.wlock = self.repo.wlock()
Bryan O'Sullivan
convert: acquire/release locks periodically
r5014 self.lock = self.repo.lock()
def after(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.debug(b'run hg sink post-conversion action\n')
Matt Mackall
convert: make hg sink cleanup safer
r10086 if self.lock:
self.lock.release()
if self.wlock:
self.wlock.release()
Brendan Cully
Split convert extension into common and repository type modules
r4536
Bryan O'Sullivan
convert: rename mapfile to revmapfile, so we can map more than just revs
r5011 def revmapfile(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 return self.repo.vfs.join(b"shamap")
Brendan Cully
Split convert extension into common and repository type modules
r4536
Edouard Gomez
convert extension: Add support for username mapping...
r4589 def authorfile(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 return self.repo.vfs.join(b"authormap")
Edouard Gomez
convert extension: Add support for username mapping...
r4589
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 def setbranch(self, branch, pbranches):
if not self.clonebranches:
Brendan Cully
convert: hg: optionally create branches as clones...
r5173 return
Augie Fackler
formatting: blacken the codebase...
r43346 setbranch = branch != self.lastbranch
Brendan Cully
convert: hg: optionally create branches as clones...
r5173 self.lastbranch = branch
if not branch:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 branch = b'default'
pbranches = [(b[0], b[1] and b[1] or b'default') for b in pbranches]
Brendan Cully
convert: hg: optionally create branches as clones...
r5173
branchpath = os.path.join(self.path, branch)
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 if setbranch:
self.after()
try:
self.repo = hg.repository(self.ui, branchpath)
Brodie Rao
cleanup: replace naked excepts with except Exception: ...
r16689 except Exception:
Brendan Cully
convert: hg: optionally create branches as clones...
r5173 self.repo = hg.repository(self.ui, branchpath, create=True)
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 self.before()
# pbranches may bring revisions from other branches (merge parents)
# Make sure we have them, or pull them.
missings = {}
for b in pbranches:
try:
self.repo.lookup(b[0])
Brodie Rao
cleanup: replace naked excepts with except Exception: ...
r16689 except Exception:
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 missings.setdefault(b[1], []).append(b[0])
Thomas Arendsen Hein
Removed trailing spaces from everything except test output
r6210
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 if missings:
self.after()
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 for pbranch, heads in sorted(pycompat.iteritems(missings)):
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 pbranchpath = os.path.join(self.path, pbranch)
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 prepo = hg.peer(self.ui, {}, pbranchpath)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.note(
_(b'pulling from %s into %s\n') % (pbranch, branch)
)
Augie Fackler
formatting: blacken the codebase...
r43346 exchange.pull(
self.repo, prepo, [prepo.lookup(h) for h in heads]
)
Patrick Mezard
convert: hg.clonebranches must pull missing parents (issue941)
r5934 self.before()
Brendan Cully
convert: hg: optionally create branches as clones...
r5173
Mads Kiilerich
convert: backout b75a04502ced and 9616b03113ce - tagmap...
r21076 def _rewritetags(self, source, revmap, data):
timeless
pycompat: switch to util.stringio for py3 compat
r28861 fp = stringio()
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 for line in data.splitlines():
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 s = line.split(b' ', 1)
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 if len(s) != 2:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.warn(_(b'invalid tag entry: "%s"\n') % line)
fp.write(b'%s\n' % line) # Bogus, but keep for hash stability
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 continue
revid = revmap.get(source.lookuprev(s[0]))
if not revid:
timeless
convert: hg use absolute_import
r28370 if s[0] == nodemod.nullhex:
Matt Mackall
convert: properly pass null ids through .hgtags (issue4678)...
r25305 revid = s[0]
else:
Matt Harbison
convert: don't drop missing or corrupt tag entries...
r39132 # missing, but keep for hash stability
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.warn(_(b'missing tag entry: "%s"\n') % line)
fp.write(b'%s\n' % line)
Matt Mackall
convert: properly pass null ids through .hgtags (issue4678)...
r25305 continue
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 fp.write(b'%s %s\n' % (revid, s[1]))
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 return fp.getvalue()
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 def _rewritesubstate(self, source, data):
timeless
pycompat: switch to util.stringio for py3 compat
r28861 fp = stringio()
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 for line in data.splitlines():
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 s = line.split(b' ', 1)
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 if len(s) != 2:
continue
revid = s[0]
subpath = s[1]
timeless
convert: hg use absolute_import
r28370 if revid != nodemod.nullhex:
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 revmap = self.subrevmaps.get(subpath)
if revmap is None:
Augie Fackler
formatting: blacken the codebase...
r43346 revmap = mapfile(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui, self.repo.wjoin(subpath, b'.hg/shamap')
Augie Fackler
formatting: blacken the codebase...
r43346 )
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 self.subrevmaps[subpath] = revmap
# It is reasonable that one or more of the subrepos don't
# need to be converted, in which case they can be cloned
# into place instead of converted. Therefore, only warn
# once.
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 msg = _(b'no ".hgsubstate" updates will be made for "%s"\n')
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 if len(revmap) == 0:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 sub = self.repo.wvfs.reljoin(subpath, b'.hg')
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558
if self.repo.wvfs.exists(sub):
self.ui.warn(msg % subpath)
newid = revmap.get(revid)
if not newid:
if len(revmap) > 0:
Augie Fackler
formatting: blacken the codebase...
r43346 self.ui.warn(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b"%s is missing from %s/.hg/shamap\n")
Augie Fackler
formatting: blacken the codebase...
r43346 % (revid, subpath)
)
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 else:
revid = newid
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 fp.write(b'%s %s\n' % (revid, subpath))
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558
return fp.getvalue()
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037 def _calculatemergedfiles(self, source, p1ctx, p2ctx):
"""Calculates the files from p2 that we need to pull in when merging p1
and p2, given that the merge is coming from the given source.
This prevents us from losing files that only exist in the target p2 and
that don't come from the source repo (like if you're merging multiple
repositories together).
"""
anc = [p1ctx.ancestor(p2ctx)]
# Calculate what files are coming from p2
actions, diverge, rename = mergemod.calculateupdates(
Augie Fackler
formatting: blacken the codebase...
r43346 self.repo,
p1ctx,
p2ctx,
anc,
branchmerge=True,
force=True,
acceptremote=False,
followcopies=False,
)
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 for file, (action, info, msg) in pycompat.iteritems(actions):
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037 if source.targetfilebelongstosource(file):
# If the file belongs to the source repo, ignore the p2
# since it will be covered by the existing fileset.
continue
# If the file requires actual merging, abort. We don't have enough
# context to resolve merges correctly.
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if action in [b'm', b'dm', b'cd', b'dc']:
Augie Fackler
formatting: blacken the codebase...
r43346 raise error.Abort(
_(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"unable to convert merge commit "
b"since target parents do not merge cleanly (file "
b"%s, parents %s and %s)"
Augie Fackler
formatting: blacken the codebase...
r43346 )
% (file, p1ctx, p2ctx)
)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 elif action == b'k':
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037 # 'keep' means nothing changed from p1
continue
else:
# Any other change means we want to take the p2 version
yield file
Augie Fackler
formatting: blacken the codebase...
r43346 def putcommit(
self, files, copies, parents, commit, source, revmap, full, cleanp2
):
Patrick Mezard
convert: hg sink commits without working dir
r6717 files = dict(files)
Mads Kiilerich
convert: optimize convert of files that are unmodified from p2 in merges...
r24395
Patrick Mezard
convert: hg sink commits without working dir
r6717 def getfilectx(repo, memctx, f):
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037 if p2ctx and f in p2files and f not in copies:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.debug(b'reusing %s from p2\n' % f)
Durham Goode
convert: fix syncing deletes from p2 merge commit...
r26078 try:
return p2ctx[f]
except error.ManifestLookupError:
# If the file doesn't exist in p2, then we're syncing a
# delete, so just return None.
return None
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 try:
v = files[f]
except KeyError:
return None
Patrick Mezard
convert: merge sources getmode() into getfile()
r11134 data, mode = source.getfile(f, v)
Mads Kiilerich
convert: use None value for missing files instead of overloading IOError...
r22296 if data is None:
return None
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if f == b'.hgtags':
Mads Kiilerich
convert: backout b75a04502ced and 9616b03113ce - tagmap...
r21076 data = self._rewritetags(source, revmap, data)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if f == b'.hgsubstate':
Matt Harbison
convert: support incremental conversion with hg subrepos...
r25558 data = self._rewritesubstate(source, data)
Augie Fackler
formatting: blacken the codebase...
r43346 return context.memfilectx(
self.repo,
memctx,
f,
data,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'l' in mode,
b'x' in mode,
Augie Fackler
formatting: blacken the codebase...
r43346 copies.get(f),
)
Patrick Mezard
convert: hg sink commits without working dir
r6717
Brendan Cully
Split convert extension into common and repository type modules
r4536 pl = []
for p in parents:
Patrick Mezard
convert: hg sink commits without working dir
r6717 if p not in pl:
Brendan Cully
Split convert extension into common and repository type modules
r4536 pl.append(p)
parents = pl
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 nparents = len(parents)
if self.filemapmode and nparents == 1:
timeless
convert: hg use absolute_import
r28370 m1node = self.repo.changelog.read(nodemod.bin(parents[0]))[0]
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 parent = parents[0]
Brendan Cully
Split convert extension into common and repository type modules
r4536
Matt Mackall
many, many trivial check-code fixups
r10282 if len(parents) < 2:
timeless
convert: hg use absolute_import
r28370 parents.append(nodemod.nullid)
Matt Mackall
many, many trivial check-code fixups
r10282 if len(parents) < 2:
timeless
convert: hg use absolute_import
r28370 parents.append(nodemod.nullid)
Brendan Cully
Split convert extension into common and repository type modules
r4536 p2 = parents.pop(0)
text = commit.desc
Sean Farley
convert: replace old sha1s in the description...
r20372
sha1s = re.findall(sha1re, text)
for sha1 in sha1s:
oldrev = source.lookuprev(sha1)
newrev = revmap.get(oldrev)
if newrev is not None:
Augie Fackler
formatting: blacken the codebase...
r43346 text = text.replace(sha1, newrev[: len(sha1)])
Sean Farley
convert: replace old sha1s in the description...
r20372
Bryan O'Sullivan
convert: make contents of "extra" dict available from sources, for sinks....
r5439 extra = commit.extra.copy()
Matt Harbison
convert: update the transplant, rebase and graft references in 'extra'...
r21765
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 sourcename = self.repo.ui.config(b'convert', b'hg.sourcename')
Durham Goode
convert: add config for recording the source name...
r25750 if sourcename:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 extra[b'convert_source'] = sourcename
Durham Goode
convert: add config for recording the source name...
r25750
Augie Fackler
formatting: blacken the codebase...
r43346 for label in (
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'source',
b'transplant_source',
b'rebase_source',
b'intermediate-source',
Augie Fackler
formatting: blacken the codebase...
r43346 ):
Matt Harbison
convert: update the transplant, rebase and graft references in 'extra'...
r21765 node = extra.get(label)
if node is None:
continue
# Only transplant stores its reference in binary
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if label == b'transplant_source':
timeless
convert: hg use absolute_import
r28370 node = nodemod.hex(node)
Matt Harbison
convert: update the transplant, rebase and graft references in 'extra'...
r21765
newrev = revmap.get(node)
if newrev is not None:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if label == b'transplant_source':
timeless
convert: hg use absolute_import
r28370 newrev = nodemod.bin(newrev)
Matt Harbison
convert: update the transplant, rebase and graft references in 'extra'...
r21765
extra[label] = newrev
Bryan O'Sullivan
convert: add config option to turn off use of branch names
r5038 if self.branchnames and commit.branch:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 extra[b'branch'] = commit.branch
Matt Harbison
convert: always track the hg source revision in the internal commit object...
r25570 if commit.rev and commit.saverev:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 extra[b'convert_revision'] = commit.rev
Thomas Arendsen Hein
removed trailing whitespace
r4957
Brendan Cully
Split convert extension into common and repository type modules
r4536 while parents:
p1 = p2
p2 = parents.pop(0)
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037 p1ctx = self.repo[p1]
Mads Kiilerich
convert: optimize convert of files that are unmodified from p2 in merges...
r24395 p2ctx = None
timeless
convert: hg use absolute_import
r28370 if p2 != nodemod.nullid:
Mads Kiilerich
convert: optimize convert of files that are unmodified from p2 in merges...
r24395 p2ctx = self.repo[p2]
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 fileset = set(files)
if full:
Mads Kiilerich
convert: don't use multi-argument set.update...
r22360 fileset.update(self.repo[p1])
fileset.update(self.repo[p2])
Durham Goode
convert: fix convert dropping p2 contents during filemap merge...
r26037
if p2ctx:
p2files = set(cleanp2)
for file in self._calculatemergedfiles(source, p1ctx, p2ctx):
p2files.add(file)
fileset.add(file)
Augie Fackler
formatting: blacken the codebase...
r43346 ctx = context.memctx(
self.repo,
(p1, p2),
text,
fileset,
getfilectx,
commit.author,
commit.date,
extra,
)
Matt Harbison
convert: apply the appropriate phases to the destination (issue4165)...
r25571
# We won't know if the conversion changes the node until after the
# commit, so copy the source's phase for now.
Augie Fackler
formatting: blacken the codebase...
r43346 self.repo.ui.setconfig(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'phases',
b'new-commit',
Augie Fackler
formatting: blacken the codebase...
r43346 phases.phasenames[commit.phase],
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'convert',
Augie Fackler
formatting: blacken the codebase...
r43346 )
Matt Harbison
convert: apply the appropriate phases to the destination (issue4165)...
r25571
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 with self.repo.transaction(b"convert") as tr:
if self.repo.ui.config(b'convert', b'hg.preserve-hash'):
Valentin Gatien-Baron
convert: add a config option to help doing identity hg->hg conversion...
r42839 origctx = commit.ctx
else:
origctx = None
node = nodemod.hex(self.repo.commitctx(ctx, origctx=origctx))
Matt Harbison
convert: apply the appropriate phases to the destination (issue4165)...
r25571
# If the node value has changed, but the phase is lower than
# draft, set it back to draft since it hasn't been exposed
# anywhere.
if commit.rev != node:
ctx = self.repo[node]
if ctx.phase() < phases.draft:
Augie Fackler
formatting: blacken the codebase...
r43346 phases.registernew(
self.repo, tr, phases.draft, [ctx.node()]
)
Matt Harbison
convert: apply the appropriate phases to the destination (issue4165)...
r25571
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 text = b"(octopus merge fixup)\n"
Durham Goode
convert: fix bug with converting the same commit twice...
r25697 p2 = node
Brendan Cully
Split convert extension into common and repository type modules
r4536
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 if self.filemapmode and nparents == 1:
Gregory Szorc
manifest: add getstorage() to manifestlog and use it globally...
r39280 man = self.repo.manifestlog.getstorage(b'')
timeless
convert: hg use absolute_import
r28370 mnode = self.repo.changelog.read(nodemod.bin(p2))[0]
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 closed = b'close' in commit.extra
Matt Mackall
convert: handle closed branch heads in hg-hg conversion (issue2185)
r11673 if not closed and not man.cmp(m1node, man.revision(mnode)):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.status(_(b"filtering out empty revision\n"))
Matt Mackall
convert: fix crazy rollback call, broken by recent rollback safety checks...
r15193 self.repo.rollback(force=True)
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 return parent
Brendan Cully
Split convert extension into common and repository type modules
r4536 return p2
def puttags(self, tags):
Martin von Zweigbergk
convert: look up branch only among branches...
r37413 tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True)
tagparent = tagparent or nodemod.nullid
Brendan Cully
Split convert extension into common and repository type modules
r4536
Sean Farley
convert: compare tags from all heads instead of just one...
r20376 oldlines = set()
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 for branch, heads in pycompat.iteritems(self.repo.branchmap()):
Sean Farley
convert: compare tags from all heads instead of just one...
r20376 for h in heads:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if b'.hgtags' in self.repo[h]:
Sean Farley
convert: compare tags from all heads instead of just one...
r20376 oldlines.update(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 set(self.repo[h][b'.hgtags'].data().splitlines(True))
Augie Fackler
formatting: blacken the codebase...
r43346 )
Sean Farley
convert: compare tags from all heads instead of just one...
r20376 oldlines = sorted(list(oldlines))
Brendan Cully
Split convert extension into common and repository type modules
r4536
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 newlines = sorted([(b"%s %s\n" % (tags[tag], tag)) for tag in tags])
Peter Arrenbrecht
cleanup: whitespace cleanup
r7877 if newlines == oldlines:
Patrick Mezard
convert: fix history topology when using hg.tagsbranch...
r9431 return None, None
Sean Farley
convert: avoid updating tags when there is nothing new...
r20377
# if the old and new tags match, then there is nothing to update
oldtags = set()
newtags = set()
for line in oldlines:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 s = line.strip().split(b' ', 1)
Sean Farley
convert: avoid updating tags when there is nothing new...
r20377 if len(s) != 2:
continue
oldtags.add(s[1])
for line in newlines:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 s = line.strip().split(b' ', 1)
Sean Farley
convert: avoid updating tags when there is nothing new...
r20377 if len(s) != 2:
continue
if s[1] not in oldtags:
newtags.add(s[1].strip())
if not newtags:
return None, None
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 data = b"".join(newlines)
Augie Fackler
formatting: blacken the codebase...
r43346
Peter Arrenbrecht
cleanup: whitespace cleanup
r7877 def getfilectx(repo, memctx, f):
Martin von Zweigbergk
memfilectx: make changectx argument mandatory in constructor (API)...
r35401 return context.memfilectx(repo, memctx, f, data, False, False, None)
Patrick Mezard
convert: hg sink commits without working dir
r6717
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.status(_(b"updating tags\n"))
date = b"%d 0" % int(time.mktime(time.gmtime()))
extra = {b'branch': self.tagsbranch}
Augie Fackler
formatting: blacken the codebase...
r43346 ctx = context.memctx(
self.repo,
(tagparent, None),
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"update tags",
[b".hgtags"],
Augie Fackler
formatting: blacken the codebase...
r43346 getfilectx,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b"convert-repo",
Augie Fackler
formatting: blacken the codebase...
r43346 date,
extra,
)
Durham Goode
convert: fix bug with converting the same commit twice...
r25697 node = self.repo.commitctx(ctx)
timeless
convert: hg use absolute_import
r28370 return nodemod.hex(node), nodemod.hex(tagparent)
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Alexis S. L. Carvalho
convert: add a mode where mercurial_sink skips empty revisions....
r5378 def setfilemapmode(self, active):
self.filemapmode = active
Edouard Gomez
convert: add bookmark support to the hg sink
r13746 def putbookmarks(self, updatedbookmark):
if not len(updatedbookmark):
return
Laurent Charignon
convert: use repo._bookmarks.recordchange instead of repo._bookmarks.write...
r26974 wlock = lock = tr = None
try:
wlock = self.repo.wlock()
lock = self.repo.lock()
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 tr = self.repo.transaction(b'bookmark')
self.ui.status(_(b"updating bookmarks\n"))
Laurent Charignon
convert: indentation change to make the next patch more legible...
r26973 destmarks = self.repo._bookmarks
Augie Fackler
formatting: blacken the codebase...
r43346 changes = [
(bookmark, nodemod.bin(updatedbookmark[bookmark]))
for bookmark in updatedbookmark
]
Boris Feld
bookmark: use 'applychanges' in the convert extension
r33487 destmarks.applychanges(self.repo, tr, changes)
Laurent Charignon
convert: use repo._bookmarks.recordchange instead of repo._bookmarks.write...
r26974 tr.close()
finally:
lockmod.release(lock, wlock, tr)
Edouard Gomez
convert: add bookmark support to the hg sink
r13746
Mads Kiilerich
convert: introduce hascommitfrommap sink method...
r21635 def hascommitfrommap(self, rev):
# the exact semantics of clonebranches is unclear so we can't say no
return rev in self.repo or self.clonebranches
Mads Kiilerich
convert: rename sink hascommit to hascommitforsplicemap...
r21634 def hascommitforsplicemap(self, rev):
Brodie Rao
cleanup: "not x in y" -> "x not in y"
r16686 if rev not in self.repo and self.clonebranches:
Augie Fackler
formatting: blacken the codebase...
r43346 raise error.Abort(
_(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'revision %s not found in destination '
b'repository (lookups with clonebranches=true '
b'are not implemented)'
Augie Fackler
formatting: blacken the codebase...
r43346 )
% rev
)
Patrick Mezard
convert: use splicemap entries when sorting revisions (issue1748)...
r16106 return rev in self.repo
Edouard Gomez
convert: add bookmark support to the hg sink
r13746
Augie Fackler
formatting: blacken the codebase...
r43346
timeless
convert: hg use absolute_import
r28370 class mercurial_source(common.converter_source):
Matt Harbison
convert: save an indicator of the repo type for sources and sinks...
r35168 def __init__(self, ui, repotype, path, revs=None):
common.converter_source.__init__(self, ui, repotype, path, revs)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ignoreerrors = ui.configbool(b'convert', b'hg.ignoreerrors')
Benoit Boissinot
convert: use set instead of dict
r8456 self.ignored = set()
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.saverev = ui.configbool(b'convert', b'hg.saverev')
Bryan O'Sullivan
convert: fail properly if we can't read a source hg repository
r5358 try:
self.repo = hg.repository(self.ui, path)
Bryan O'Sullivan
convert: report errors more meaningfully if run with --traceback
r5437 # try to provoke an exception if this isn't really a hg
# repo, but some other bogus compatible-looking url
Alexis S. L. Carvalho
convert: make sure mercurial_source has a local hg repo
r5522 if not self.repo.local():
Brodie Rao
cleanup: "raise SomeException()" -> "raise SomeException"
r16687 raise error.RepoError
Matt Mackall
error: move repo errors...
r7637 except error.RepoError:
Matt Mackall
ui: print_exc() -> traceback()
r8206 ui.traceback()
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 raise NoRepo(_(b"%s is not a local Mercurial repository") % path)
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 self.lastrev = None
self.lastctx = None
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 self._changescache = None, None
Bryan O'Sullivan
convert: tell the source repository when a rev has been converted...
r5554 self.convertfp = None
Patrick Mezard
convert: implement startrev for hg source
r6885 # Restrict converted revisions to startrev descendants
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 startnode = ui.config(b'convert', b'hg.startrev')
hgrevs = ui.config(b'convert', b'hg.revs')
Mads Kiilerich
convert: introduce hg.revs to replace hg.startrev and --rev with a revset...
r19891 if hgrevs is None:
if startnode is not None:
try:
startnode = self.repo.lookup(startnode)
except error.RepoError:
Augie Fackler
formatting: blacken the codebase...
r43346 raise error.Abort(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b'%s is not a valid start revision') % startnode
Augie Fackler
formatting: blacken the codebase...
r43346 )
Mads Kiilerich
convert: introduce hg.revs to replace hg.startrev and --rev with a revset...
r19891 startrev = self.repo.changelog.rev(startnode)
children = {startnode: 1}
for r in self.repo.changelog.descendants([startrev]):
children[self.repo.changelog.node(r)] = 1
self.keep = children.__contains__
else:
self.keep = util.always
Durham Goode
convert: add support for specifying multiple revs...
r25748 if revs:
Martin von Zweigbergk
convert: use repo.lookup() for converting to nodeid...
r37379 self._heads = [self.repo.lookup(r) for r in revs]
Mads Kiilerich
convert: introduce hg.revs to replace hg.startrev and --rev with a revset...
r19891 else:
self._heads = self.repo.heads()
Patrick Mezard
convert: implement startrev for hg source
r6885 else:
Durham Goode
convert: add support for specifying multiple revs...
r25748 if revs or startnode is not None:
Augie Fackler
formatting: blacken the codebase...
r43346 raise error.Abort(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(
b'hg.revs cannot be combined with '
b'hg.startrev or --rev'
)
Augie Fackler
formatting: blacken the codebase...
r43346 )
Mads Kiilerich
convert: introduce hg.revs to replace hg.startrev and --rev with a revset...
r19891 nodes = set()
parents = set()
for r in scmutil.revrange(self.repo, [hgrevs]):
ctx = self.repo[r]
nodes.add(ctx.node())
parents.update(p.node() for p in ctx.parents())
self.keep = nodes.__contains__
self._heads = nodes - parents
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 def _changectx(self, rev):
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 if self.lastrev != rev:
Matt Mackall
use repo[changeid] to get a changectx
r6747 self.lastctx = self.repo[rev]
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 self.lastrev = rev
return self.lastctx
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 def _parents(self, ctx):
Patrick Mezard
convert/hg: make parents() return changectx, not nodes
r9531 return [p for p in ctx.parents() if p and self.keep(p.node())]
Patrick Mezard
convert: implement startrev for hg source
r6885
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 def getheads(self):
timeless
convert: hg use absolute_import
r28370 return [nodemod.hex(h) for h in self._heads if self.keep(h)]
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
def getfile(self, name, rev):
try:
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 fctx = self._changectx(rev)[name]
Patrick Mezard
convert: merge sources getmode() into getfile()
r11134 return fctx.data(), fctx.flags()
Mads Kiilerich
convert: use None value for missing files instead of overloading IOError...
r22296 except error.LookupError:
return None, None
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 def _changedfiles(self, ctx1, ctx2):
Martin von Zweigbergk
convert: use manifest.diff() instead of ctx.status()...
r27719 ma, r = [], []
maappend = ma.append
rappend = r.append
d = ctx1.manifest().diff(ctx2.manifest())
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 for f, ((node1, flag1), (node2, flag2)) in pycompat.iteritems(d):
Martin von Zweigbergk
convert: use manifest.diff() instead of ctx.status()...
r27719 if node2 is None:
rappend(f)
else:
maappend(f)
return ma, r
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 def getchanges(self, rev, full):
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 ctx = self._changectx(rev)
parents = self._parents(ctx)
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 if full or not parents:
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 files = copyfiles = ctx.manifest()
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 if parents:
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 if self._changescache[0] == rev:
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 ma, r = self._changescache[1]
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 else:
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 ma, r = self._changedfiles(parents[0], ctx)
Mads Kiilerich
convert: introduce --full for converting all files...
r22300 if not full:
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 files = ma + r
copyfiles = ma
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 # _getcopies() is also run for roots and before filtering so missing
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 # revlogs are detected early
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 copies = self._getcopies(ctx, parents, copyfiles)
Mads Kiilerich
convert: optimize convert of files that are unmodified from p2 in merges...
r24395 cleanp2 = set()
if len(parents) == 2:
Martin von Zweigbergk
convert: use manifest.diff() instead of ctx.status()...
r27719 d = parents[1].manifest().diff(ctx.manifest(), clean=True)
Gregory Szorc
py3: define and use pycompat.iteritems() for hgext/...
r43375 for f, value in pycompat.iteritems(d):
Martin von Zweigbergk
convert: use manifest.diff() instead of ctx.status()...
r27719 if value is None:
cleanp2.add(f)
Mads Kiilerich
convert: refactor hg getchanges and caching
r22299 changes = [(f, rev) for f in files if f not in self.ignored]
changes.sort()
Mads Kiilerich
convert: optimize convert of files that are unmodified from p2 in merges...
r24395 return changes, copies, cleanp2
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 def _getcopies(self, ctx, parents, files):
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 copies = {}
Alexis S. L. Carvalho
convert: mercurial_source: also search for copies in modified files...
r5280 for name in files:
Patrick Mezard
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)...
r7231 if name in self.ignored:
continue
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 try:
Martin von Zweigbergk
convert: migrate to new method for getting copy source...
r41937 copysource = ctx.filectx(name).copysource()
Mads Kiilerich
convert: fix bad conversion of copies when hg.startrev is specified...
r19457 if copysource in self.ignored:
Patrick Mezard
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)...
r7231 continue
Patrick Mezard
convert/hg: handle bogus copy records (issue1843)
r9532 # Ignore copy sources not in parent revisions
Martin von Zweigbergk
convert: don't reimplement any()...
r36358 if not any(copysource in p for p in parents):
Patrick Mezard
convert/hg: handle bogus copy records (issue1843)
r9532 continue
Patrick Mezard
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)...
r7231 copies[name] = copysource
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 except TypeError:
pass
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except error.LookupError as e:
Patrick Mezard
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)...
r7231 if not self.ignoreerrors:
raise
Benoit Boissinot
convert: use set instead of dict
r8456 self.ignored.add(name)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.warn(_(b'ignoring: %s\n') % e)
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 return copies
Thomas Arendsen Hein
Remove trailing spaces, fix indentation
r5143
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 def getcommit(self, rev):
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 ctx = self._changectx(rev)
Mads Kiilerich
convert: keep converted hg parents that are outside convert.hg.revs (BC)...
r28900 _parents = self._parents(ctx)
parents = [p.hex() for p in _parents]
optparents = [p.hex() for p in ctx.parents() if p and p not in _parents]
Matt Harbison
convert: always track the hg source revision in the internal commit object...
r25570 crev = rev
Augie Fackler
formatting: blacken the codebase...
r43346 return common.commit(
author=ctx.user(),
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 date=dateutil.datestr(ctx.date(), b'%Y-%m-%d %H:%M:%S %1%2'),
Augie Fackler
formatting: blacken the codebase...
r43346 desc=ctx.description(),
rev=crev,
parents=parents,
optparents=optparents,
branch=ctx.branch(),
extra=ctx.extra(),
sortkey=ctx.rev(),
saverev=self.saverev,
phase=ctx.phase(),
ctx=ctx,
)
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013
Matt Harbison
convert: add missing numcommits() override to hg sources...
r41215 def numcommits(self):
return len(self.repo)
Bryan O'Sullivan
convert: Support Mercurial as a source, as well as a sink
r5013 def gettags(self):
Mads Kiilerich
convert: mercurial source: convert global tags only - not local tags...
r21498 # This will get written to .hgtags, filter non global tags out.
Augie Fackler
formatting: blacken the codebase...
r43346 tags = [
t
for t in self.repo.tagslist()
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 if self.repo.tagtype(t[0]) == b'global'
Augie Fackler
formatting: blacken the codebase...
r43346 ]
Augie Fackler
cleanup: run pyupgrade on our source tree to clean up varying things...
r44937 return {
name: nodemod.hex(node) for name, node in tags if self.keep(node)
}
Alexis S. L. Carvalho
mercurial_source: add --filemap support
r5379
def getchangedfiles(self, rev, i):
Martin von Zweigbergk
convert: use _ prefix for private methods in hg sink...
r27717 ctx = self._changectx(rev)
parents = self._parents(ctx)
Patrick Mezard
convert: implement startrev for hg source
r6885 if not parents and i is None:
i = 0
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 ma, r = ctx.manifest().keys(), []
Patrick Mezard
convert: implement startrev for hg source
r6885 else:
i = i or 0
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 ma, r = self._changedfiles(parents[i], ctx)
ma, r = [[f for f in l if f not in self.ignored] for l in (ma, r)]
Alexis S. L. Carvalho
mercurial_source: add --filemap support
r5379
if i == 0:
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 self._changescache = (rev, (ma, r))
Alexis S. L. Carvalho
mercurial_source: add --filemap support
r5379
Martin von Zweigbergk
convert: replace cache of (m,a,r) by (ma,r)...
r27718 return ma + r
Alexis S. L. Carvalho
mercurial_source: add --filemap support
r5379
Bryan O'Sullivan
convert: tell the source repository when a rev has been converted...
r5554 def converted(self, rev, destrev):
if self.convertfp is None:
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.convertfp = open(self.repo.vfs.join(b'shamap'), b'ab')
self.convertfp.write(util.tonativeeol(b'%s %s\n' % (destrev, rev)))
Bryan O'Sullivan
convert: tell the source repository when a rev has been converted...
r5554 self.convertfp.flush()
Patrick Mezard
test-convert: test before() and after() conversion actions
r5805
def before(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.debug(b'run hg source pre-conversion action\n')
Patrick Mezard
test-convert: test before() and after() conversion actions
r5805
def after(self):
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 self.ui.debug(b'run hg source post-conversion action\n')
Patrick Mezard
convert: fail fast if source does not support --sourcesort
r8691
def hasnativeorder(self):
return True
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693
Constantine Linnick
convert: add closesort algorithm to mercurial sources...
r18819 def hasnativeclose(self):
return True
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 def lookuprev(self, rev):
try:
timeless
convert: hg use absolute_import
r28370 return nodemod.hex(self.repo.lookup(rev))
Matt Harbison
convert: handle LookupError in mercurial_source.lookuprev()...
r23926 except (error.RepoError, error.LookupError):
Patrick Mezard
convert: rewrite tags when converting from hg to hg
r8693 return None
Edouard Gomez
convert: add bookmark support to hg source
r13757
def getbookmarks(self):
return bookmarks.listbookmarks(self.repo)
Ben Goswami
splicemap: improve error handling when source is hg (issue2084)...
r19120
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 def checkrevformat(self, revstr, mapname=b'splicemap'):
Ben Goswami
splicemap: improve error handling when source is hg (issue2084)...
r19120 """ Mercurial, revision string is a 40 byte hex """
Sean Farley
convert: add mapname parameter to checkrevformat...
r20373 self.checkhexformat(revstr, mapname)