Mercurial > hg
changeset 8104:fd7cc930ab8f
Merge with crew-stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 17 Apr 2009 11:16:50 -0500 |
parents | 6ea0318daf75 (current diff) 66d0a03d3afc (diff) |
children | 0019be957555 |
files | |
diffstat | 20 files changed, 268 insertions(+), 143 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/bzr.py Tue Mar 24 23:28:55 2009 +0000 +++ b/hgext/convert/bzr.py Fri Apr 17 11:16:50 2009 -0500 @@ -21,6 +21,8 @@ except ImportError: pass +supportedkinds = ('file', 'symlink') + class bzr_source(converter_source): """Reads Bazaar repositories by using the Bazaar Python libraries""" @@ -71,7 +73,7 @@ def getfile(self, name, rev): revtree = self.sourcerepo.revision_tree(rev) fileid = revtree.path2id(name) - if fileid is None: + if fileid is None or revtree.kind(fileid) not in supportedkinds: # the file is not available anymore - was deleted raise IOError(_('%s is not available in %s anymore') % (name, rev)) @@ -181,6 +183,7 @@ # renamed if path and path != topath: renames[topath] = path + changes.append((path, revid)) # populate the mode cache kind, executable = [e[1] for e in (kind, executable)]
--- a/hgext/convert/monotone.py Tue Mar 24 23:28:55 2009 +0000 +++ b/hgext/convert/monotone.py Fri Apr 17 11:16:50 2009 -0500 @@ -111,12 +111,10 @@ def mtnrenamefiles(self, files, fromdir, todir): renamed = {} for tofile in files: - suffix = tofile.lstrip(todir) - if todir + suffix == tofile: - renamed[tofile] = (fromdir + suffix).lstrip("/") + if tofile.startswith(todir + '/'): + renamed[tofile] = fromdir + tofile[len(todir):] return renamed - # implement the converter_source interface: def getheads(self): @@ -157,6 +155,7 @@ for tofile, fromfile in renamed.items(): self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") % (fromfile, tofile), '\n') files[tofile] = rev + copies[tofile] = fromfile for fromfile in renamed.values(): files[fromfile] = rev return (files.items(), copies)
--- a/hgext/convert/p4.py Tue Mar 24 23:28:55 2009 +0000 +++ b/hgext/convert/p4.py Fri Apr 17 11:16:50 2009 -0500 @@ -45,7 +45,7 @@ def _parse_view(self, path): "Read changes affecting the path" - cmd = "p4 -G changes -s submitted '%s'" % path + cmd = 'p4 -G changes -s submitted "%s"' % path stdout = util.popen(cmd) for d in loaditer(stdout): c = d.get("change", None) @@ -64,7 +64,7 @@ else: views = {"//": ""} else: - cmd = "p4 -G client -o '%s'" % path + cmd = 'p4 -G client -o "%s"' % path clientspec = marshal.load(util.popen(cmd)) views = {} @@ -139,7 +139,7 @@ return self.heads def getfile(self, name, rev): - cmd = "p4 -G print '%s#%s'" % (self.depotname[name], rev) + cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev) stdout = util.popen(cmd) mode = None
--- a/hgext/extdiff.py Tue Mar 24 23:28:55 2009 +0000 +++ b/hgext/extdiff.py Fri Apr 17 11:16:50 2009 -0500 @@ -50,16 +50,25 @@ from mercurial import cmdutil, util, commands import os, shlex, shutil, tempfile -def snapshot_node(ui, repo, files, node, tmproot): - '''snapshot files as of some revision''' +def snapshot(ui, repo, files, node, tmproot): + '''snapshot files as of some revision + if not using snapshot, -I/-X does not work and recursive diff + in tools like kdiff3 and meld displays too many files.''' dirname = os.path.basename(repo.root) if dirname == "": dirname = "root" - dirname = '%s.%s' % (dirname, short(node)) + if node is not None: + dirname = '%s.%s' % (dirname, short(node)) base = os.path.join(tmproot, dirname) os.mkdir(base) - ui.note(_('making snapshot of %d files from rev %s\n') % - (len(files), short(node))) + if node is not None: + ui.note(_('making snapshot of %d files from rev %s\n') % + (len(files), short(node))) + else: + ui.note(_('making snapshot of %d files from working dir\n') % + (len(files))) + wopener = util.opener(base) + fns_and_mtime = [] ctx = repo[node] for fn in files: wfn = util.pconvert(fn) @@ -68,47 +77,18 @@ continue ui.note(' %s\n' % wfn) dest = os.path.join(base, wfn) - destdir = os.path.dirname(dest) - if not os.path.isdir(destdir): - os.makedirs(destdir) - data = repo.wwritedata(wfn, ctx[wfn].data()) - open(dest, 'wb').write(data) - return dirname - - -def snapshot_wdir(ui, repo, files, tmproot): - '''snapshot files from working directory. - if not using snapshot, -I/-X does not work and recursive diff - in tools like kdiff3 and meld displays too many files.''' - dirname = os.path.basename(repo.root) - if dirname == "": - dirname = "root" - base = os.path.join(tmproot, dirname) - os.mkdir(base) - ui.note(_('making snapshot of %d files from working dir\n') % - (len(files))) - - fns_and_mtime = [] - - for fn in files: - wfn = util.pconvert(fn) - ui.note(' %s\n' % wfn) - dest = os.path.join(base, wfn) - destdir = os.path.dirname(dest) - if not os.path.isdir(destdir): - os.makedirs(destdir) - - fp = open(dest, 'wb') - for chunk in util.filechunkiter(repo.wopener(wfn)): - fp.write(chunk) - fp.close() - - fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest))) - - + fctx = ctx[wfn] + data = repo.wwritedata(wfn, fctx.data()) + if 'l' in fctx.flags(): + wopener.symlink(data, wfn) + else: + wopener(wfn, 'w').write(data) + if 'x' in fctx.flags(): + util.set_flags(dest, False, True) + if node is None: + fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest))) return dirname, fns_and_mtime - def dodiff(ui, repo, diffcmd, diffopts, pats, opts): '''Do the actuall diff: @@ -139,24 +119,17 @@ dir2root = '' try: # Always make a copy of node1 - dir1 = snapshot_node(ui, repo, modified + removed, node1, tmproot) + dir1 = snapshot(ui, repo, modified + removed, node1, tmproot)[0] changes = len(modified) + len(removed) + len(added) - fns_and_mtime = [] - # If node2 in not the wc or there is >1 change, copy it - if node2: - dir2 = snapshot_node(ui, repo, modified + added, node2, tmproot) - elif changes > 1: - #we only actually need to get the files to copy back to the working - #dir in this case (because the other cases are: diffing 2 revisions - #or single file -- in which case the file is already directly passed - #to the diff tool). - dir2, fns_and_mtime = snapshot_wdir(ui, repo, modified + added, tmproot) + if node2 or changes > 1: + dir2, fns_and_mtime = snapshot(ui, repo, modified + added, node2, tmproot) else: # This lets the diff tool open the changed file directly dir2 = '' dir2root = repo.root + fns_and_mtime = [] # If only one change, diff the files instead of the directories if changes == 1 :
--- a/mercurial/commands.py Tue Mar 24 23:28:55 2009 +0000 +++ b/mercurial/commands.py Fri Apr 17 11:16:50 2009 -0500 @@ -1966,11 +1966,8 @@ """output the current or given revision of the project manifest Print a list of version controlled files for the given revision. - If no revision is given, the parent of the working directory is used, - or tip if no revision is checked out. - - The manifest is the list of files being version controlled. If no revision - is given then the first parent of the working directory is used. + If no revision is given, the first parent of the working directory + is used, or the null revision if none is checked out. With -v flag, print file permissions, symlink and executable bits. With --debug flag, print file revision hashes.
--- a/mercurial/context.py Tue Mar 24 23:28:55 2009 +0000 +++ b/mercurial/context.py Fri Apr 17 11:16:50 2009 -0500 @@ -513,7 +513,7 @@ return True def __contains__(self, key): - return self._dirstate[key] not in "?r" + return self._repo.dirstate[key] not in "?r" def _manifest(self): """generate a manifest corresponding to the working directory"""
--- a/mercurial/httprepo.py Tue Mar 24 23:28:55 2009 +0000 +++ b/mercurial/httprepo.py Fri Apr 17 11:16:50 2009 -0500 @@ -99,13 +99,14 @@ except AttributeError: proto = resp.headers['content-type'] + safeurl = url.hidepassword(self._url) # accept old "text/plain" and "application/hg-changegroup" for now if not (proto.startswith('application/mercurial-') or proto.startswith('text/plain') or proto.startswith('application/hg-changegroup')): - self.ui.debug(_("Requested URL: '%s'\n") % cu) + self.ui.debug(_("Requested URL: '%s'\n") % url.hidepassword(cu)) raise error.RepoError(_("'%s' does not appear to be an hg repository") - % self._url) + % safeurl) if proto.startswith('application/mercurial-'): try: @@ -113,10 +114,10 @@ version_info = tuple([int(n) for n in version.split('.')]) except ValueError: raise error.RepoError(_("'%s' sent a broken Content-Type " - "header (%s)") % (self._url, proto)) + "header (%s)") % (safeurl, proto)) if version_info > (0, 1): raise error.RepoError(_("'%s' uses newer protocol %s") % - (self._url, version)) + (safeurl, version)) return resp
--- a/mercurial/revlog.py Tue Mar 24 23:28:55 2009 +0000 +++ b/mercurial/revlog.py Fri Apr 17 11:16:50 2009 -0500 @@ -450,7 +450,10 @@ if self.version == REVLOGV0: self._io = revlogoldio() if i: - d = self._io.parseindex(f, self._inline) + try: + d = self._io.parseindex(f, self._inline) + except (ValueError, IndexError), e: + raise RevlogError(_("index %s is corrupted") % (self.indexfile)) self.index, self.nodemap, self._chunkcache = d # add the magic null revision at -1 (if it hasn't been done already)
--- a/tests/test-convert-bzr Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-bzr Fri Apr 17 11:16:50 2009 -0500 @@ -8,15 +8,22 @@ bzr init -q source cd source echo a > a -bzr add -q a -bzr commit -q -m 'Initial add: a' +echo c > c +echo e > e +bzr add -q a c e +bzr commit -q -m 'Initial add: a, c, e' bzr mv a b +bzr mv c d +bzr mv e f echo a2 >> a -bzr add -q a -bzr commit -q -m 'rename a into b, create a' +mkdir e +bzr add -q a e +bzr commit -q -m 'rename a into b, create a, rename c into d' cd .. hg convert source source-hg glog -R source-hg +echo "% manifest" +hg manifest -R source-hg -r tip echo "% test --rev option" hg convert -r 1 source source-1-hg glog -R source-1-hg
--- a/tests/test-convert-bzr.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-bzr.out Fri Apr 17 11:16:50 2009 -0500 @@ -1,22 +1,29 @@ % create and rename on the same file in the same step a => b +c => d +e => f initializing destination source-hg repository scanning source... sorting... converting... -1 Initial add: a -0 rename a into b, create a -o 1 "rename a into b, create a" files: a b +1 Initial add: a, c, e +0 rename a into b, create a, rename c into d +o 1 "rename a into b, create a, rename c into d" files: a b c d e f | -o 0 "Initial add: a" files: a +o 0 "Initial add: a, c, e" files: a c e +% manifest +a +b +d +f % test --rev option initializing destination source-1-hg repository scanning source... sorting... converting... -0 Initial add: a -o 0 "Initial add: a" files: a +0 Initial add: a, c, e +o 0 "Initial add: a, c, e" files: a c e % merge initializing destination source-hg repository
--- a/tests/test-convert-mtn Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-mtn Fri Apr 17 11:16:50 2009 -0500 @@ -55,7 +55,16 @@ mtn drop dir/b mtn mv bin bin2 mtn ci -m 'update2 "with" quotes' -# Test directory move +echo '% test directory move' +mkdir -p dir1/subdir1 +mkdir -p dir1/subdir2_other +echo file1 > dir1/subdir1/file1 +echo file2 > dir1/subdir2_other/file1 +mtn add dir1/subdir1/file1 dir1/subdir2_other/file1 +mtn ci -m createdir1 +mtn rename dir1/subdir1 dir1/subdir2 +mtn ci -m movedir1 +echo '% test subdirectory move' mtn mv dir dir2 mtn ci -m movedir # Test directory removal with empty directory @@ -85,5 +94,13 @@ echo % contents cat dir2/a test -d dir2/dir && echo 'removed dir2/dir is still there!' + +echo % file move +hg log -v -C -r 1 | grep copies +echo % check directory move +hg manifest -r 4 +test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' +test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' +hg log -v -C -r 4 | grep copies exit 0
--- a/tests/test-convert-mtn.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-mtn.out Fri Apr 17 11:16:50 2009 -0500 @@ -26,32 +26,51 @@ mtn: renaming bin to bin2 in workspace manifest mtn: beginning commit on branch 'com.selenic.test' mtn: committed revision 6c6977a6ef609ec80e40779f89dbd2772c96de62 +% test directory move +mtn: adding dir1 to workspace manifest +mtn: adding dir1/subdir1 to workspace manifest +mtn: adding dir1/subdir1/file1 to workspace manifest +mtn: adding dir1/subdir2_other to workspace manifest +mtn: adding dir1/subdir2_other/file1 to workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision e066b1feb2b7a7110450c2c18b5b4462011427d1 +mtn: skipping dir1, already accounted for in workspace +mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest +mtn: beginning commit on branch 'com.selenic.test' +mtn: committed revision 2ad2409d25bb8d2583b57a3d4c0fa1df62aa1f79 +% test subdirectory move mtn: renaming dir to dir2 in workspace manifest mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision 5de5abe7c15eae70cf3acdda23c9c319ea50c1af +mtn: committed revision a85290b81fc4a8fbce4dc4d956404109842b406e mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision 27a423be1e406595cc57f50f42a8790fa0a93d8e +mtn: committed revision 7e3c8746060117104f16ff2d9212cf0f810cbff0 mtn: dropping dir2/dir/subdir/f from workspace manifest mtn: dropping dir2/dir/subdir from workspace manifest mtn: dropping dir2/dir/emptydir from workspace manifest mtn: dropping dir2/dir from workspace manifest mtn: beginning commit on branch 'com.selenic.test' -mtn: committed revision ba57ba5ac63178529d37fa8a2a1a012fc0e42047 +mtn: committed revision a97e0433d041a6d253c5dc27e080d544e55d9c19 % convert incrementally assuming destination repo.mtn-hg scanning source... sorting... converting... -3 update2 "with" quotes +5 update2 "with" quotes +4 createdir1 +3 movedir1 2 movedir 1 emptydir 0 dropdirectory -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ 5 "dropdirectory" files: dir2/dir/subdir/f +5 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ 7 "dropdirectory" files: dir2/dir/subdir/f +| +o 6 "emptydir" files: dir2/dir/subdir/f | -o 4 "emptydir" files: dir2/dir/subdir/f +o 5 "movedir" files: dir/a dir2/a | -o 3 "movedir" files: dir/a dir2/a +o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 +| +o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1 | o 2 "update2 "with" quotes" files: bin bin2 dir/b e | @@ -61,8 +80,19 @@ % manifest bin2 +dir1/subdir2/file1 +dir1/subdir2_other/file1 dir2/a e % contents a a +% file move +copies: dir/a (a) +% check directory move +bin2 +dir/a +dir1/subdir2/file1 +dir1/subdir2_other/file1 +e +copies: dir1/subdir2/file1 (dir1/subdir1/file1)
--- a/tests/test-convert-p4 Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-p4 Fri Apr 17 11:16:50 2009 -0500 @@ -63,9 +63,9 @@ echo % interesting names echo dddd > "d d" -mkdir " e " -echo fff >" e /f " -p4 add "d d" " e /f " +mkdir " e" +echo fff >" e/ f" +p4 add "d d" " e/ f" p4 submit -d "add d e f" echo % convert again
--- a/tests/test-convert-p4.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-p4.out Fri Apr 17 11:16:50 2009 -0500 @@ -62,10 +62,10 @@ rev=0 desc="initial" tags="" files="a b/c" % interesting names //depot/test-mercurial-import/d d#1 - opened for add -//depot/test-mercurial-import/ e /f #1 - opened for add +//depot/test-mercurial-import/ e/ f#1 - opened for add Submitting change 5. Locking 2 files ... -add //depot/test-mercurial-import/ e /f #1 +add //depot/test-mercurial-import/ e/ f#1 add //depot/test-mercurial-import/d d#1 Change 5 submitted. % convert again @@ -80,7 +80,7 @@ sorting... converting... 0 add d e f -rev=4 desc="add d e f" tags="tip" files=" e /f d d" +rev=4 desc="add d e f" tags="tip" files=" e/ f d d" rev=3 desc="change a b/c" tags="" files="a b/c" rev=2 desc="change b/c" tags="" files="b/c" rev=1 desc="change a" tags="" files="a"
--- a/tests/test-convert-svn-sink Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-svn-sink Fri Apr 17 11:16:50 2009 -0500 @@ -12,12 +12,12 @@ ( cd $1; svn up; - svn st -v | fixpath + svn st -v | fixpath | sed 's/ */ /g' limit='' if [ $2 -gt 0 ]; then limit="--limit=$2" fi - svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' + svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | grep -v 'kind="' ) }
--- a/tests/test-convert-svn-sink.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-convert-svn-sink.out Fri Apr 17 11:16:50 2009 -0500 @@ -12,11 +12,11 @@ 1 add a file 0 modify a file At revision 2. - 2 2 test . - 2 2 test a - 2 1 test d1 - 2 1 test d1/d2 - 2 1 test d1/d2/b + 2 2 test . + 2 2 test a + 2 1 test d1 + 2 1 test d1/d2 + 2 1 test d1/d2/b <?xml version="1.0"?> <log> <logentry @@ -63,11 +63,11 @@ converting... 0 rename a file At revision 3. - 3 3 test . - 3 3 test b - 3 1 test d1 - 3 1 test d1/d2 - 3 1 test d1/d2/b + 3 3 test . + 3 3 test b + 3 1 test d1 + 3 1 test d1/d2 + 3 1 test d1/d2/b <?xml version="1.0"?> <log> <logentry @@ -101,12 +101,12 @@ converting... 0 copy a file At revision 4. - 4 4 test . - 4 3 test b - 4 4 test c - 4 1 test d1 - 4 1 test d1/d2 - 4 1 test d1/d2/b + 4 4 test . + 4 3 test b + 4 4 test c + 4 1 test d1 + 4 1 test d1/d2 + 4 1 test d1/d2/b <?xml version="1.0"?> <log> <logentry @@ -140,11 +140,11 @@ converting... 0 remove a file At revision 5. - 5 5 test . - 5 4 test c - 5 1 test d1 - 5 1 test d1/d2 - 5 1 test d1/d2/b + 5 5 test . + 5 4 test c + 5 1 test d1 + 5 1 test d1/d2 + 5 1 test d1/d2/b <?xml version="1.0"?> <log> <logentry @@ -174,11 +174,11 @@ converting... 0 make a file executable At revision 6. - 6 6 test . - 6 6 test c - 6 1 test d1 - 6 1 test d1/d2 - 6 1 test d1/d2/b + 6 6 test . + 6 6 test c + 6 1 test d1 + 6 1 test d1/d2 + 6 1 test d1/d2/b <?xml version="1.0"?> <log> <logentry @@ -203,9 +203,9 @@ converting... 0 add executable file in new directory At revision 1. - 1 1 test . - 1 1 test d1 - 1 1 test d1/a + 1 1 test . + 1 1 test d1 + 1 1 test d1/a <?xml version="1.0"?> <log> <logentry @@ -230,11 +230,11 @@ converting... 0 copy file to new directory At revision 2. - 2 2 test . - 2 1 test d1 - 2 1 test d1/a - 2 2 test d2 - 2 2 test d2/a + 2 2 test . + 2 1 test d1 + 2 1 test d1/a + 2 2 test d2 + 2 2 test d2/a <?xml version="1.0"?> <log> <logentry @@ -280,12 +280,12 @@ 0 merge % expect 4 changes At revision 4. - 4 4 test . - 4 3 test b - 4 2 test left-1 - 4 3 test left-2 - 4 4 test right-1 - 4 4 test right-2 + 4 4 test . + 4 3 test b + 4 2 test left-1 + 4 3 test left-2 + 4 4 test right-1 + 4 4 test right-2 <?xml version="1.0"?> <log> <logentry
--- a/tests/test-extdiff Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-extdiff Fri Apr 17 11:16:50 2009 -0500 @@ -28,7 +28,7 @@ hg falabala -r 0:1 # test diff during merge -hg update 0 +hg update -C 0 echo c >> c hg add c hg ci -m "new branch" -d '1 0' @@ -43,3 +43,24 @@ # check diff are made from the first parent hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" #hg log + +echo +echo '% test extdiff of multiple files in tmp dir:' +hg update -C 0 > /dev/null +echo changed > a +echo changed > b +chmod +x b +echo '% diff in working directory, before' +hg diff --git +echo '% edit with extdiff -p' +# prepare custom diff/edit tool +cat > differ.sh << EOT +#!/bin/sh +sleep 1 # avoid unchanged-timestamp problems +echo edited >> a/a +echo edited >> a/b +EOT +chmod +x differ.sh +hg extdiff -p `pwd`/differ.sh # will change to /tmp/extdiff.TMP and populate directories a.TMP and a and start tool +echo '% diff in working directory, after' +hg diff --git
--- a/tests/test-extdiff.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-extdiff.out Fri Apr 17 11:16:50 2009 -0500 @@ -34,3 +34,38 @@ diffing a.8a5febb7f867/a a.34eed99112ab/a diffing a.2a13a4d2da36/a a.46c0e4daeb72/a diff-like tools yield a non-zero exit code + +% test extdiff of multiple files in tmp dir: +% diff in working directory, before +diff --git a/a b/a +--- a/a ++++ b/a +@@ -1,1 +1,1 @@ +-a ++changed +diff --git a/b b/b +old mode 100644 +new mode 100755 +--- a/b ++++ b/b +@@ -1,1 +1,1 @@ +-b ++changed +% edit with extdiff -p +% diff in working directory, after +diff --git a/a b/a +--- a/a ++++ b/a +@@ -1,1 +1,2 @@ +-a ++changed ++edited +diff --git a/b b/b +old mode 100644 +new mode 100755 +--- a/b ++++ b/b +@@ -1,1 +1,2 @@ +-b ++changed ++edited
--- a/tests/test-verify Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-verify Fri Apr 17 11:16:50 2009 -0500 @@ -1,7 +1,8 @@ #!/bin/sh echo % prepare repo -hg init +hg init a +cd a echo "some text" > FOO.txt echo "another text" > bar.txt echo "more text" > QUICK.txt @@ -23,4 +24,22 @@ echo % verify hg verify +cd .. + +echo % test revlog corruption +hg init b +cd b + +touch a +hg add a +hg ci -m a + +echo 'corrupted' > b +head -c 20 .hg/store/data/a.i > start +cat start b > .hg/store/data/a.i + +echo +echo % verify +hg verify + exit 0
--- a/tests/test-verify.out Tue Mar 24 23:28:55 2009 +0000 +++ b/tests/test-verify.out Fri Apr 17 11:16:50 2009 -0500 @@ -29,3 +29,16 @@ 3 files, 1 changesets, 0 total revisions 9 integrity errors encountered! (first damaged changeset appears to be 0) +% test revlog corruption + +% verify +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files + a@0: broken revlog! (index data/a.i is corrupted) +warning: orphan revlog 'data/a.i' +1 files, 1 changesets, 0 total revisions +1 warnings encountered! +1 integrity errors encountered! +(first damaged changeset appears to be 0)