##// END OF EJS Templates
verify: check the subrepository references in .hgsubstate...
verify: check the subrepository references in .hgsubstate While hopefully atypical, there are reasons that a subrepository revision can be lost that aren't covered by corruption of the .hgsubstate revlog. Such things can happen when a subrepo is amended, stripped or simply isn't pulled from upstream because the parent repo revision wasn't updated yet. There's no way to know if it is an error, but this will find potential problems sooner than when some random revision is updated. Until recently, convert made no attempt at rewriting the .hgsubstate file. The impetuous for this is to verify the conversion of some repositories, and this is orders of magnitude faster than a bash script from 0..tip that does an 'hg update -C $rev'. But it is equally useful to determine if everything has been pulled down before taking a thumb drive on the go. It feels somewhat wrong to leave this out of verifymod (mostly because the file is already read in there, and the final summary is printed before the subrepos are checked). But verifymod looks very low level, so importing subrepo stuff there seems more wrong.

File last commit:

r23692:f7819211 default
r25591:f1d46075 default
Show More
autodiff.py
44 lines | 1.4 KiB | text/x-python | PythonLexer
Patrick Mezard
patch: support diff data loss detection and upgrade...
r10189 # Extension dedicated to test patch.diff() upgrade modes
#
#
Gregory Szorc
tests: declare commands using decorator
r21254 from mercurial import cmdutil, scmutil, patch, util
Patrick Mezard
patch: support diff data loss detection and upgrade...
r10189
Gregory Szorc
tests: declare commands using decorator
r21254 cmdtable = {}
command = cmdutil.command(cmdtable)
@command('autodiff',
[('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')],
'[OPTION]... [FILE]...')
Patrick Mezard
patch: support diff data loss detection and upgrade...
r10189 def autodiff(ui, repo, *pats, **opts):
Siddharth Agarwal
tests/autodiff.py: explicitly only honor feature diffopts...
r23692 diffopts = patch.difffeatureopts(ui, opts)
Patrick Mezard
patch: support diff data loss detection and upgrade...
r10189 git = opts.get('git', 'no')
brokenfiles = set()
losedatafn = None
if git in ('yes', 'no'):
diffopts.git = git == 'yes'
diffopts.upgrade = False
elif git == 'auto':
diffopts.git = False
diffopts.upgrade = True
elif git == 'warn':
diffopts.git = False
diffopts.upgrade = True
def losedatafn(fn=None, **kwargs):
brokenfiles.add(fn)
return True
elif git == 'abort':
diffopts.git = False
diffopts.upgrade = True
def losedatafn(fn=None, **kwargs):
raise util.Abort('losing data for %s' % fn)
else:
raise util.Abort('--git must be yes, no or auto')
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 node1, node2 = scmutil.revpair(repo, [])
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 m = scmutil.match(repo[node2], pats, opts)
Patrick Mezard
patch: support diff data loss detection and upgrade...
r10189 it = patch.diff(repo, node1, node2, match=m, opts=diffopts,
losedatafn=losedatafn)
for chunk in it:
ui.write(chunk)
for fn in sorted(brokenfiles):
Matt Mackall
i18n: wrap false positives for translation detection
r17956 ui.write(('data lost for: %s\n' % fn))