Mercurial > hg
changeset 11831:00fee6394daf
merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 12 Aug 2010 18:08:52 -0500 |
parents | 3152c978496a (current diff) f1c2de22b8a8 (diff) |
children | 7fa36341e7a0 |
files | tests/test-add tests/test-add.out tests/test-alias tests/test-alias.out tests/test-clone tests/test-clone.out tests/test-commit tests/test-commit-copy tests/test-commit-copy.out tests/test-commit-unresolved tests/test-commit-unresolved.out tests/test-commit.out tests/test-committer tests/test-committer.out tests/test-conflict tests/test-conflict.out tests/test-copy tests/test-copy.out tests/test-flags tests/test-flags.out tests/test-hook tests/test-hook.out tests/test-identify tests/test-identify.out tests/test-import tests/test-import-eol tests/test-import-eol.out tests/test-import.out tests/test-init tests/test-init.out tests/test-parents tests/test-parents.out tests/test-patch tests/test-patch.out tests/test-paths tests/test-paths.out tests/test-status tests/test-status-color tests/test-status-color.out tests/test-status.out tests/test-symlink-addremove tests/test-symlink-addremove.out tests/test-symlink-basic tests/test-symlink-basic.out tests/test-symlink-root tests/test-symlink-root.out tests/test-symlinks tests/test-symlinks.out tests/test-tag tests/test-tag.out tests/test-transplant tests/test-transplant.out tests/test-verify tests/test-verify.out tests/test-walk tests/test-walk.out |
diffstat | 104 files changed, 5296 insertions(+), 5216 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Aug 12 18:10:42 2010 +0200 +++ b/contrib/check-code.py Thu Aug 12 18:08:52 2010 -0500 @@ -7,7 +7,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import re, glob, os +import re, glob, os, sys import optparse def repquote(m): @@ -261,5 +261,8 @@ check = args for f in check: - checkfile(f, maxerr=options.per_file, warnings=options.warnings, - blame=options.blame) + ret = 0 + if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, + blame=options.blame): + ret = 1 + sys.exit(ret)
--- a/hgext/bookmarks.py Thu Aug 12 18:10:42 2010 +0200 +++ b/hgext/bookmarks.py Thu Aug 12 18:08:52 2010 -0500 @@ -299,7 +299,7 @@ self.ui.debug("checking for updated bookmarks\n") rb = remote.listkeys('bookmarks') - changes = 0 + changed = False for k in rb.keys(): if k in self._bookmarks: nr, nl = rb[k], self._bookmarks[k] @@ -310,12 +310,12 @@ continue if cr in cl.descendants(): self._bookmarks[k] = cr.node() - changes += 1 + changed = True self.ui.status(_("updating bookmark %s\n") % k) else: self.ui.warn(_("not updating divergent" " bookmark %s\n") % k) - if changes: + if changed: write(repo) return result
--- a/hgext/convert/subversion.py Thu Aug 12 18:10:42 2010 +0200 +++ b/hgext/convert/subversion.py Thu Aug 12 18:08:52 2010 -0500 @@ -1157,4 +1157,5 @@ os.unlink(messagefile) def puttags(self, tags): - self.ui.warn(_('XXX TAGS NOT IMPLEMENTED YET\n')) + self.ui.warn(_('writing Subversion tags is not yet implemented\n')) + return None, None
--- a/hgext/graphlog.py Thu Aug 12 18:10:42 2010 +0200 +++ b/hgext/graphlog.py Thu Aug 12 18:08:52 2010 -0500 @@ -217,8 +217,8 @@ def check_unsupported_flags(opts): for op in ["follow", "follow_first", "date", "copies", "keyword", "remove", - "only_merges", "user", "only_branch", "prune", "newest_first", - "no_merges", "include", "exclude"]: + "only_merges", "user", "branch", "only_branch", "prune", + "newest_first", "no_merges", "include", "exclude"]: if op in opts and opts[op]: raise util.Abort(_("--graph option is incompatible with --%s") % op.replace("_", "-"))
--- a/hgext/mq.py Thu Aug 12 18:10:42 2010 +0200 +++ b/hgext/mq.py Thu Aug 12 18:08:52 2010 -0500 @@ -513,7 +513,7 @@ # apply failed, strip away that rev and merge. hg.clean(repo, head) - self.strip(repo, n, update=False, backup='strip') + self.strip(repo, [n], update=False, backup='strip') ctx = repo[rev] ret = hg.merge(repo, rev) @@ -895,7 +895,7 @@ finally: release(wlock) - def strip(self, repo, rev, update=True, backup="all", force=None): + def strip(self, repo, revs, update=True, backup="all", force=None): wlock = lock = None try: wlock = repo.wlock() @@ -903,12 +903,13 @@ if update: self.check_localchanges(repo, force=force, refresh=False) - urev = self.qparents(repo, rev) + urev = self.qparents(repo, revs[0]) hg.clean(repo, urev) repo.dirstate.write() self.removeundo(repo) - repair.strip(self.ui, repo, rev, backup) + for rev in revs: + repair.strip(self.ui, repo, rev, backup) # strip may have unbundled a set of backed up revisions after # the actual strip self.removeundo(repo) @@ -1197,7 +1198,7 @@ for patch in reversed(self.applied[start:end]): self.ui.status(_("popping %s\n") % patch.name) del self.applied[start:end] - self.strip(repo, rev, update=False, backup='strip') + self.strip(repo, [rev], update=False, backup='strip') if self.applied: self.ui.write(_("now at: %s\n") % self.applied[-1].name) else: @@ -1377,7 +1378,7 @@ repo.dirstate.setparents(*cparents) self.applied.pop() self.applied_dirty = 1 - self.strip(repo, top, update=False, + self.strip(repo, [top], update=False, backup='strip') except: repo.dirstate.invalidate() @@ -1532,7 +1533,7 @@ update = True else: update = False - self.strip(repo, rev, update=update, backup='strip') + self.strip(repo, [rev], update=update, backup='strip') if qpp: self.ui.warn(_("saved queue repository parents: %s %s\n") % (short(qpp[0]), short(qpp[1]))) @@ -1934,7 +1935,7 @@ if qbase: ui.note(_('stripping applied patches from destination ' 'repository\n')) - dr.mq.strip(dr, qbase, update=False, backup=None) + dr.mq.strip(dr, [qbase], update=False, backup=None) if not opts['noupdate']: ui.note(_('updating destination repository\n')) hg.update(dr, dr.changelog.tip()) @@ -2171,7 +2172,15 @@ ''' def status(idx): guards = q.series_guards[idx] or ['unguarded'] - ui.write('%s: ' % ui.label(q.series[idx], 'qguard.patch')) + if q.series[idx] in applied: + state = 'applied' + elif q.pushable(idx)[0]: + state = 'unapplied' + else: + state = 'guarded' + label = 'qguard.patch qguard.%s qseries.%s' % (state, state) + ui.write('%s: ' % ui.label(q.series[idx], label)) + for i, guard in enumerate(guards): if guard.startswith('+'): ui.write(guard, label='qguard.positive') @@ -2183,6 +2192,7 @@ ui.write(' ') ui.write('\n') q = repo.mq + applied = set(p.name for p in q.applied) patch = None args = list(args) if opts['list']: @@ -2396,14 +2406,12 @@ pass return 0 -def strip(ui, repo, rev, **opts): - """strip a changeset and all its descendants from the repository - - The strip command removes all changesets whose local revision - number is greater than or equal to REV, and then restores any - changesets that are not descendants of REV. If the working - directory has uncommitted changes, the operation is aborted unless - the --force flag is supplied. +def strip(ui, repo, *revs, **opts): + """strip changesets and all their descendants from the repository + + The strip command removes the specified changesets and all their + descendants. If the working directory has uncommitted changes, + the operation is aborted unless the --force flag is supplied. If a parent of the working directory is stripped, then the working directory will automatically be updated to the most recent @@ -2426,30 +2434,42 @@ elif opts['nobackup']: backup = 'none' - rev = repo.lookup(rev) - p = repo.dirstate.parents() cl = repo.changelog - update = True - if p[0] == nullid: - update = False - elif p[1] == nullid and rev != cl.ancestor(p[0], rev): - update = False - elif rev not in (cl.ancestor(p[0], rev), cl.ancestor(p[1], rev)): - update = False + revs = set(cl.rev(repo.lookup(r)) for r in revs) + + descendants = set(cl.descendants(*revs)) + strippedrevs = revs.union(descendants) + roots = revs.difference(descendants) + + update = False + # if one of the wdir parent is stripped we'll need + # to update away to an earlier revision + for p in repo.dirstate.parents(): + if p != nullid and cl.rev(p) in strippedrevs: + update = True + break + + rootnodes = set(cl.node(r) for r in roots) q = repo.mq if q.applied: - if rev == cl.ancestor(repo.lookup('qtip'), rev): + # refresh queue state if we're about to strip + # applied patches + if cl.rev(repo.lookup('qtip')) in strippedrevs: q.applied_dirty = True start = 0 end = len(q.applied) - applied_list = [i.node for i in q.applied] - if rev in applied_list: - start = applied_list.index(rev) + for i, statusentry in enumerate(q.applied): + if statusentry.node in rootnodes: + # if one of the stripped roots is an applied + # patch, only part of the queue is stripped + start = i + break del q.applied[start:end] q.save_dirty() - repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force']) + repo.mq.strip(repo, list(rootnodes), backup=backup, update=update, + force=opts['force']) return 0 def select(ui, repo, *args, **opts): @@ -3008,7 +3028,7 @@ ' number greater than REV which are not' ' descendants of REV (DEPRECATED)')), ('n', 'nobackup', None, _('no backups'))], - _('hg strip [-f] [-n] REV')), + _('hg strip [-f] [-n] REV...')), "qtop": (top, [] + seriesopts, _('hg qtop [-s]')), "qunapplied": (unapplied,
--- a/mercurial/cmdutil.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/cmdutil.py Thu Aug 12 18:08:52 2010 -0500 @@ -638,7 +638,7 @@ fp.write("# HG changeset patch\n") fp.write("# User %s\n" % ctx.user()) fp.write("# Date %d %d\n" % ctx.date()) - if branch and (branch != 'default'): + if branch and branch != 'default': fp.write("# Branch %s\n" % branch) fp.write("# Node ID %s\n" % hex(node)) fp.write("# Parent %s\n" % hex(prev))
--- a/mercurial/commands.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/commands.py Thu Aug 12 18:08:52 2010 -0500 @@ -4177,7 +4177,7 @@ _('show only heads which are descendants of REV'), _('REV')), ('t', 'topo', False, _('show topological heads only')), ('a', 'active', False, - _('show active branchheads only [DEPRECATED]')), + _('show active branchheads only (DEPRECATED)')), ('c', 'closed', False, _('show normal and closed branch heads')), ] + templateopts,
--- a/mercurial/context.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/context.py Thu Aug 12 18:08:52 2010 -0500 @@ -75,7 +75,7 @@ @propertycache def substate(self): - return subrepo.state(self) + return subrepo.state(self, self._repo.ui) def __contains__(self, key): return key in self._manifest
--- a/mercurial/hg.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/hg.py Thu Aug 12 18:08:52 2010 -0500 @@ -221,7 +221,7 @@ src_repo = repository(ui, source) else: src_repo = source - branch = (None, []) + branch = (None, branch or []) origsource = source = src_repo.url() rev, checkout = addbranchrevs(src_repo, src_repo, branch, rev)
--- a/mercurial/merge.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/merge.py Thu Aug 12 18:08:52 2010 -0500 @@ -117,7 +117,7 @@ def manifestmerge(repo, p1, p2, pa, overwrite, partial): """ - Merge p1 and p2 with ancestor ma and generate merge action list + Merge p1 and p2 with ancestor pa and generate merge action list overwrite = whether we clobber working files partial = function to filter file lists
--- a/mercurial/patch.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/patch.py Thu Aug 12 18:08:52 2010 -0500 @@ -927,8 +927,8 @@ createfunc = hunk.createfile missing = not goodb and not gooda and not createfunc() - # some diff programs apparently produce create patches where the - # afile is not /dev/null, but afile starts with bfile + # some diff programs apparently produce patches where the afile is + # not /dev/null, but afile starts with bfile abasedir = afile[:afile.rfind('/') + 1] bbasedir = bfile[:bfile.rfind('/') + 1] if missing and abasedir == bbasedir and afile.startswith(bfile):
--- a/mercurial/repair.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/repair.py Thu Aug 12 18:08:52 2010 -0500 @@ -11,14 +11,18 @@ from i18n import _ import os -def _bundle(repo, bases, heads, node, suffix, extranodes=None): +def _bundle(repo, bases, heads, node, suffix, extranodes=None, compress=True): """create a bundle with the specified revisions as a backup""" cg = repo.changegroupsubset(bases, heads, 'strip', extranodes) backupdir = repo.join("strip-backup") if not os.path.isdir(backupdir): os.mkdir(backupdir) name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix)) - return changegroup.writebundle(cg, name, "HG10BZ") + if compress: + bundletype = "HG10BZ" + else: + bundletype = "HG10UN" + return changegroup.writebundle(cg, name, bundletype) def _collectfiles(repo, striprev): """find out the filelogs affected by the strip""" @@ -69,6 +73,8 @@ # TODO delete the undo files, and handle undo of merge sets striprev = cl.rev(node) + keeppartialbundle = backup == 'strip' + # Some revisions with rev > striprev may not be descendants of striprev. # We have to find these revisions and put them in a bundle, so that # we can restore them after the truncations. @@ -110,8 +116,9 @@ backupfile = _bundle(repo, [node], cl.heads(), node, 'backup') repo.ui.status(_("saved backup bundle to %s\n") % backupfile) if saveheads or extranodes: + # do not compress partial bundle if we remove it from disk later chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', - extranodes) + extranodes=extranodes, compress=keeppartialbundle) mfst = repo.manifest @@ -146,7 +153,7 @@ if not repo.ui.verbose: repo.ui.popbuffer() f.close() - if backup != "strip": + if not keeppartialbundle: os.unlink(chgrpfile) except: if backupfile:
--- a/mercurial/store.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/store.py Thu Aug 12 18:08:52 2010 -0500 @@ -22,7 +22,7 @@ .replace(".d/", ".d.hg/")) def decodedir(path): - if not path.startswith('data/'): + if not path.startswith('data/') or ".hg/" not in path: return path return (path .replace(".d.hg/", ".d/")
--- a/mercurial/subrepo.py Thu Aug 12 18:10:42 2010 +0200 +++ b/mercurial/subrepo.py Thu Aug 12 18:08:52 2010 -0500 @@ -12,7 +12,7 @@ nullstate = ('', '', 'empty') -def state(ctx): +def state(ctx, ui): """return a state dict, mapping subrepo paths configured in .hgsub to tuple: (source from .hgsub, revision from .hgsubstate, kind (key in types dict)) @@ -27,6 +27,9 @@ if '.hgsub' in ctx: read('.hgsub') + for path, src in ui.configitems('subpaths'): + p.set('subpaths', path, src, ui.configsource('subpaths', path)) + rev = {} if '.hgsubstate' in ctx: try: @@ -45,6 +48,14 @@ raise util.Abort(_('missing ] in subrepo source')) kind, src = src.split(']', 1) kind = kind[1:] + + for pattern, repl in p.items('subpaths'): + try: + src = re.sub(pattern, repl, src, 1) + except re.error, e: + raise util.Abort(_("bad subrepository pattern in %s: %s") + % (p.source('subpaths', pattern), e)) + state[path] = (src.strip(), rev.get(path, ''), kind) return state
--- a/tests/run-tests.py Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/run-tests.py Thu Aug 12 18:08:52 2010 -0500 @@ -499,6 +499,13 @@ finally: os.remove(name) + def rematch(el, l): + try: + return re.match(el, l) + except re.error: + # el is an invalid regex + return False + pos = -1 postout = [] for n, l in enumerate(output): @@ -513,7 +520,7 @@ if el == l: # perfect match (fast) postout.append(" " + l) - elif el and re.match(el, l): # fallback regex match + elif el and rematch(el, l): # fallback regex match postout.append(" " + el) else: # mismatch - let diff deal with it postout.append(" " + l)
--- a/tests/test-add Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#!/bin/sh - -hg init a -cd a -echo a > a -hg add -n -hg st -hg add -hg st -hg forget a -hg add -hg st - -echo b > b -hg add -n b -hg st -hg add b || echo "failed to add b" -hg st -echo % should fail -hg add b -hg st - -hg ci -m 0 --traceback -echo % should fail -hg add a - -echo aa > a -hg ci -m 1 -hg up 0 -echo aaa > a -hg ci -m 2 - -hg merge -hg st -echo % should fail -hg add a -hg st -hg resolve -m a -hg ci -m merge - -echo % issue683 -hg forget a -hg add a -hg st -hg rm a -hg st -echo a > a -hg add a -hg st - -hg add c && echo "unexpected addition of missing file" -echo c > c -hg add d c && echo "unexpected addition of missing file" -hg st -
--- a/tests/test-add.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -adding a -? a -adding a -A a -adding a -A a -A a -? b -A a -A b -% should fail -b already tracked! -A a -A b -% should fail -a already tracked! -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -merging a -warning: conflicts during merge. -merging a failed! -0 files updated, 0 files merged, 0 files removed, 1 files unresolved -use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon -M a -? a.orig -% should fail -a already tracked! -M a -? a.orig -% issue683 -? a.orig -R a -? a.orig -M a -? a.orig -c: No such file or directory -d: No such file or directory -M a -A c -? a.orig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-add.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,96 @@ + $ hg init a + $ cd a + $ echo a > a + $ hg add -n + adding a + $ hg st + ? a + $ hg add + adding a + $ hg st + A a + $ hg forget a + $ hg add + adding a + $ hg st + A a + + $ echo b > b + $ hg add -n b + $ hg st + A a + ? b + $ hg add b || echo "failed to add b" + $ hg st + A a + A b + +should fail + + $ hg add b + b already tracked! + $ hg st + A a + A b + + $ hg ci -m 0 --traceback + +should fail + + $ hg add a + a already tracked! + + $ echo aa > a + $ hg ci -m 1 + $ hg up 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo aaa > a + $ hg ci -m 2 + created new head + + $ hg merge + merging a + warning: conflicts during merge. + merging a failed! + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon + $ hg st + M a + ? a.orig + +should fail + + $ hg add a + a already tracked! + $ hg st + M a + ? a.orig + $ hg resolve -m a + $ hg ci -m merge + +issue683 + + $ hg forget a + $ hg add a + $ hg st + ? a.orig + $ hg rm a + $ hg st + R a + ? a.orig + $ echo a > a + $ hg add a + $ hg st + M a + ? a.orig + + $ hg add c && echo "unexpected addition of missing file" + c: No such file or directory + $ echo c > c + $ hg add d c && echo "unexpected addition of missing file" + d: No such file or directory + $ hg st + M a + A c + ? a.orig +
--- a/tests/test-alias Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#!/bin/sh - -cat >> $HGRCPATH <<EOF -[alias] -myinit = init -cleanstatus = status -c -unknown = bargle -ambiguous = s -recursive = recursive -nodefinition = -no--cwd = status --cwd elsewhere -no-R = status -R elsewhere -no--repo = status --repo elsewhere -no--repository = status --repository elsewhere -mylog = log -lognull = log -r null -shortlog = log --template '{rev} {node|short} | {date|isodate}\n' -dln = lognull --debug -nousage = rollback -put = export -r 0 -o "\$FOO/%R.diff" -echo = !echo -rt = root - -[defaults] -mylog = -q -lognull = -q -log = -v -EOF - -echo '% basic' -hg myinit alias - -echo '% unknown' -hg unknown -hg help unknown - -echo '% ambiguous' -hg ambiguous -hg help ambiguous - -echo '% recursive' -hg recursive -hg help recursive - -echo '% no definition' -hg nodef -hg help nodef - -echo '% invalid options' -hg no--cwd -hg help no--cwd -hg no-R -hg help no-R -hg no--repo -hg help no--repo -hg no--repository -hg help no--repository - -cd alias - -echo '% no usage' -hg nousage - -echo foo > foo -hg ci -Amfoo - -echo '% with opts' -hg cleanst - -echo '% with opts and whitespace' -hg shortlog - -echo '% interaction with defaults' -hg mylog -hg lognull - -echo '% properly recursive' -hg dln - -echo '% path expanding' -FOO=`pwd` hg put -cat 0.diff - -echo '% shell aliases' -hg echo foo -echo '% invalid arguments' -hg rt foo - -exit 0
--- a/tests/test-alias.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -% basic -% unknown -alias 'unknown' resolves to unknown command 'bargle' -alias 'unknown' resolves to unknown command 'bargle' -% ambiguous -alias 'ambiguous' resolves to ambiguous command 's' -alias 'ambiguous' resolves to ambiguous command 's' -% recursive -alias 'recursive' resolves to unknown command 'recursive' -alias 'recursive' resolves to unknown command 'recursive' -% no definition -no definition for alias 'nodefinition' -no definition for alias 'nodefinition' -% invalid options -error in definition for alias 'no--cwd': --cwd may only be given on the command line -error in definition for alias 'no--cwd': --cwd may only be given on the command line -error in definition for alias 'no-R': -R may only be given on the command line -error in definition for alias 'no-R': -R may only be given on the command line -error in definition for alias 'no--repo': --repo may only be given on the command line -error in definition for alias 'no--repo': --repo may only be given on the command line -error in definition for alias 'no--repository': --repository may only be given on the command line -error in definition for alias 'no--repository': --repository may only be given on the command line -% no usage -no rollback information available -adding foo -% with opts -C foo -% with opts and whitespace -0 e63c23eaa88a | 1970-01-01 00:00 +0000 -% interaction with defaults -0:e63c23eaa88a --1:000000000000 -% properly recursive -changeset: -1:0000000000000000000000000000000000000000 -parent: -1:0000000000000000000000000000000000000000 -parent: -1:0000000000000000000000000000000000000000 -manifest: -1:0000000000000000000000000000000000000000 -user: -date: Thu Jan 01 00:00:00 1970 +0000 -extra: branch=default - -% path expanding -# HG changeset patch -# User test -# Date 0 0 -# Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 -# Parent 0000000000000000000000000000000000000000 -foo - -diff -r 000000000000 -r e63c23eaa88a foo ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/foo Thu Jan 01 00:00:00 1970 +0000 -@@ -0,0 +1,1 @@ -+foo -% shell aliases -foo -% invalid arguments -hg rt: invalid arguments -hg rt - -alias for: hg root - -print the root (top) of the current working directory - - Print the root directory of the current repository. - - Returns 0 on success. - -use "hg -v help rt" to show global options
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-alias.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,170 @@ + $ cat >> $HGRCPATH <<EOF + > [alias] + > myinit = init + > cleanstatus = status -c + > unknown = bargle + > ambiguous = s + > recursive = recursive + > nodefinition = + > no--cwd = status --cwd elsewhere + > no-R = status -R elsewhere + > no--repo = status --repo elsewhere + > no--repository = status --repository elsewhere + > mylog = log + > lognull = log -r null + > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' + > dln = lognull --debug + > nousage = rollback + > put = export -r 0 -o "\$FOO/%R.diff" + > echo = !echo + > rt = root + > + > [defaults] + > mylog = -q + > lognull = -q + > log = -v + > EOF + + +basic + + $ hg myinit alias + + +unknown + + $ hg unknown + alias 'unknown' resolves to unknown command 'bargle' + $ hg help unknown + alias 'unknown' resolves to unknown command 'bargle' + + +ambiguous + + $ hg ambiguous + alias 'ambiguous' resolves to ambiguous command 's' + $ hg help ambiguous + alias 'ambiguous' resolves to ambiguous command 's' + + +recursive + + $ hg recursive + alias 'recursive' resolves to unknown command 'recursive' + $ hg help recursive + alias 'recursive' resolves to unknown command 'recursive' + + +no definition + + $ hg nodef + no definition for alias 'nodefinition' + $ hg help nodef + no definition for alias 'nodefinition' + + +invalid options + + $ hg no--cwd + error in definition for alias 'no--cwd': --cwd may only be given on the command line + $ hg help no--cwd + error in definition for alias 'no--cwd': --cwd may only be given on the command line + $ hg no-R + error in definition for alias 'no-R': -R may only be given on the command line + $ hg help no-R + error in definition for alias 'no-R': -R may only be given on the command line + $ hg no--repo + error in definition for alias 'no--repo': --repo may only be given on the command line + $ hg help no--repo + error in definition for alias 'no--repo': --repo may only be given on the command line + $ hg no--repository + error in definition for alias 'no--repository': --repository may only be given on the command line + $ hg help no--repository + error in definition for alias 'no--repository': --repository may only be given on the command line + + $ cd alias + + +no usage + + $ hg nousage + no rollback information available + + $ echo foo > foo + $ hg ci -Amfoo + adding foo + + +with opts + + $ hg cleanst + C foo + + +with opts and whitespace + + $ hg shortlog + 0 e63c23eaa88a | 1970-01-01 00:00 +0000 + + +interaction with defaults + + $ hg mylog + 0:e63c23eaa88a + $ hg lognull + -1:000000000000 + + +properly recursive + + $ hg dln + changeset: -1:0000000000000000000000000000000000000000 + parent: -1:0000000000000000000000000000000000000000 + parent: -1:0000000000000000000000000000000000000000 + manifest: -1:0000000000000000000000000000000000000000 + user: + date: Thu Jan 01 00:00:00 1970 +0000 + extra: branch=default + + + +path expanding + + $ FOO=`pwd` hg put + $ cat 0.diff + # HG changeset patch + # User test + # Date 0 0 + # Node ID e63c23eaa88ae77967edcf4ea194d31167c478b0 + # Parent 0000000000000000000000000000000000000000 + foo + + diff -r 000000000000 -r e63c23eaa88a foo + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/foo Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +foo + + +shell aliases + + $ hg echo foo + foo + +invalid arguments + + $ hg rt foo + hg rt: invalid arguments + hg rt + + alias for: hg root + + print the root (top) of the current working directory + + Print the root directory of the current repository. + + Returns 0 on success. + + use "hg -v help rt" to show global options + + $ exit 0
--- a/tests/test-check-code Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-check-code Thu Aug 12 18:08:52 2010 -0500 @@ -35,3 +35,5 @@ check_code=`dirname $0`/../contrib/check-code.py ${check_code} ./wrong.py ./correct.py ./quote.py ./non-py24.py + +exit 0
--- a/tests/test-clone Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -#!/bin/sh - -echo -echo % prepare repo a -mkdir a -cd a -hg init -echo a > a -hg add a -hg commit -m test -echo first line > b -hg add b -# create a non-inlined filelog -python -c 'for x in range(10000): print x' >> data1 -for j in 0 1 2 3 4 5 6 7 8 9; do - cat data1 >> b - hg commit -m test -done -echo % "list files in store/data (should show a 'b.d')" -for i in .hg/store/data/*; do - echo $i -done - -echo -echo % default operation -hg clone . ../b -cd ../b -cat a -hg verify - -echo -echo % no update, with debug option -hg --debug clone -U . ../c -cd ../c -cat a 2>/dev/null || echo "a not present" -hg verify - -echo -echo % default destination -mkdir ../d -cd ../d -hg clone ../a -cd a -hg cat a - -echo -echo % "check that we drop the file: from the path before" -echo % "writing the .hgrc" -cd ../.. -hg clone file:a e -grep 'file:' e/.hg/hgrc - -echo -echo % check that path aliases are expanded -hg clone -q -U --config 'paths.foobar=a#0' foobar f -hg -R f showconfig paths.default | sed -e 's,.*/,,' - -echo -echo % use --pull -hg clone --pull a g -hg -R g verify - -echo -echo % clone to '.' -mkdir h -cd h -hg clone ../a . -cd .. - -echo -echo -echo % "*** tests for option -u ***" -echo - - -echo -echo % "adding some more history to repo a" -cd a -echo % "tag ref1" -hg tag ref1 -echo the quick brown fox >a -hg ci -m "hacked default" -echo % "updating back to ref1" -hg up ref1 -echo -echo % "add branch 'stable' to repo a for later tests" -hg branch stable -echo some text >a -hg ci -m "starting branch stable" -echo % "tag ref2" -hg tag ref2 -echo some more text >a -hg ci -m "another change for branch stable" -echo -echo % "updating back to ref2" -hg up ref2 -echo -echo % "parents of repo a" -hg parents -echo -echo % "repo a has two heads" -hg heads -cd .. - -echo -echo % "testing clone -U -u 1 a ua (must abort)" -hg clone -U -u 1 a ua - -echo -echo % "testing clone -u . a ua" -hg clone -u . a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone --pull -u . a ua" -hg clone --pull -u . a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -u stable a ua" -hg clone -u stable a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "branch stable is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone a ua" -hg clone a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "branch default is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone -u . a#stable ua" -hg clone -u . a#stable ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -u . -r stable a ua" -hg clone -u . -r stable a ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -r stable a ua" -hg clone -r stable a ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "branch stable is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone -u . -r stable -r default a ua" -hg clone -u . -r stable -r default a ua -echo -echo % "repo ua has two heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -cat <<EOF > simpleclone.py -from mercurial import ui, hg -myui = ui.ui() -repo = hg.repository(myui, 'a') -hg.clone(myui, repo, dest="ua") -EOF - -python simpleclone.py -rm -r ua - -exit 0
--- a/tests/test-clone.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,316 +0,0 @@ - -% prepare repo a -% list files in store/data (should show a 'b.d') -.hg/store/data/a.i -.hg/store/data/b.d -.hg/store/data/b.i - -% default operation -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -a -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% no update, with debug option -linked 8 files -a not present -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% default destination -destination directory: a -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -a - -% check that we drop the file: from the path before -% writing the .hgrc -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% check that path aliases are expanded -a#0 - -% use --pull -requesting all changes -adding changesets -adding manifests -adding file changes -added 11 changesets with 11 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% clone to . -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - - -% *** tests for option -u *** - - -% adding some more history to repo a -% tag ref1 -% updating back to ref1 -1 files updated, 0 files merged, 1 files removed, 0 files unresolved - -% add branch 'stable' to repo a for later tests -marked working directory as branch stable -% tag ref2 - -% updating back to ref2 -1 files updated, 0 files merged, 1 files removed, 0 files unresolved - -% parents of repo a -changeset: 13:e8ece76546a6 -branch: stable -tag: ref2 -parent: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: starting branch stable - - -% repo a has two heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% testing clone -U -u 1 a ua (must abort) -abort: cannot specify both --noupdate and --updaterev - -% testing clone -u . a ua -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone --pull -u . a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 16 changesets with 16 changes to 3 files (+1 heads) -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -u stable a ua -updating to branch stable -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% branch stable is checked out -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - - -% testing clone a ua -updating to branch default -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% branch default is checked out -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% testing clone -u . a#stable ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -u . -r stable a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -r stable a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% branch stable is checked out -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - - -% testing clone -u . -r stable -r default a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 16 changesets with 16 changes to 3 files (+1 heads) -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has two heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 -updating to branch default -3 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-clone.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,443 @@ +Prepare repo a: + + $ mkdir a + $ cd a + $ hg init + $ echo a > a + $ hg add a + $ hg commit -m test + $ echo first line > b + $ hg add b + +Create a non-inlined filelog: + + $ python -c 'for x in range(10000): print x' >> data1 + $ for j in 0 1 2 3 4 5 6 7 8 9; do + > cat data1 >> b + > hg commit -m test + > done + +List files in store/data (should show a 'b.d'): + + $ for i in .hg/store/data/*; do + > echo $i + > done + .hg/store/data/a.i + .hg/store/data/b.d + .hg/store/data/b.i + +Default operation: + + $ hg clone . ../b + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../b + $ cat a + a + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +No update, with debug option: + + $ hg --debug clone -U . ../c + linked 8 files + $ cd ../c + $ cat a 2>/dev/null || echo "a not present" + a not present + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +Default destination: + + $ mkdir ../d + $ cd ../d + $ hg clone ../a + destination directory: a + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd a + $ hg cat a + a + $ cd ../.. + +Check that we drop the 'file:' from the path before writing the .hgrc: + + $ hg clone file:a e + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ grep 'file:' e/.hg/hgrc + +Check that path aliases are expanded: + + $ hg clone -q -U --config 'paths.foobar=a#0' foobar f + $ hg -R f showconfig paths.default + .*/a#0 + +Use --pull: + + $ hg clone --pull a g + requesting all changes + adding changesets + adding manifests + adding file changes + added 11 changesets with 11 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg -R g verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +Clone to '.': + + $ mkdir h + $ cd h + $ hg clone ../a . + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd .. + + +*** Tests for option -u *** + +Adding some more history to repo a: + + $ cd a + $ hg tag ref1 + $ echo the quick brown fox >a + $ hg ci -m "hacked default" + $ hg up ref1 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg branch stable + marked working directory as branch stable + $ echo some text >a + $ hg ci -m "starting branch stable" + $ hg tag ref2 + $ echo some more text >a + $ hg ci -m "another change for branch stable" + $ hg up ref2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg parents + changeset: 13:e8ece76546a6 + branch: stable + tag: ref2 + parent: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: starting branch stable + + +Repo a has two heads: + + $ hg heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + + $ cd .. + + +Testing --noupdate with --updaterev (must abort): + + $ hg clone --noupdate --updaterev 1 a ua + abort: cannot specify both --noupdate and --updaterev + + +Testing clone -u: + + $ hg clone -u . a ua + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing clone --pull -u: + + $ hg clone --pull -u . a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 16 changesets with 16 changes to 3 files (+1 heads) + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing clone -u <branch>: + + $ hg clone -u stable a ua + updating to branch stable + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Branch 'stable' is checked out: + + $ hg -R ua parents + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + + $ rm -r ua + + +Testing default checkout: + + $ hg clone a ua + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Branch 'default' is checked out: + + $ hg -R ua parents + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + + $ rm -r ua + + +Testing #<branch>: + + $ hg clone -u . a#stable ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing -u -r <branch>: + + $ hg clone -u . -r stable a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing -r <branch>: + + $ hg clone -r stable a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Branch 'stable' is checked out: + + $ hg -R ua parents + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + + $ rm -r ua + + +Testing issue2267: + + $ cat <<EOF > simpleclone.py + > from mercurial import ui, hg + > myui = ui.ui() + > repo = hg.repository(myui, 'a') + > hg.clone(myui, repo, dest="ua") + > EOF + + $ python simpleclone.py + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ rm -r ua + +cat <<EOF > branchclone.py +from mercurial import ui, hg +myui = ui.ui() +repo = hg.repository(myui, 'a') +hg.clone(myui, repo, dest="ua", branch=["stable",]) +EOF + +python branchclone.py +rm -r ua +
--- a/tests/test-commit Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -#!/bin/sh - -echo % commit date test -hg init test -cd test -echo foo > foo -hg add foo -HGEDITOR=true hg commit -m "" -hg commit -d '0 0' -m commit-1 -echo foo >> foo -hg commit -d '1 4444444' -m commit-3 -hg commit -d '1 15.1' -m commit-4 -hg commit -d 'foo bar' -m commit-5 -hg commit -d ' 1 4444' -m commit-6 -hg commit -d '111111111111 0' -m commit-7 - -echo % commit added file that has been deleted -echo bar > bar -hg add bar -rm bar -hg commit -d "1000000 0" -m commit-8 -hg commit -d "1000000 0" -m commit-8-2 bar - -hg -q revert -a --no-backup - -mkdir dir -echo boo > dir/file -hg add -hg -v commit -m commit-9 dir - -echo > dir.file -hg add -hg commit -m commit-10 dir dir.file - -echo >> dir/file -mkdir bleh -mkdir dir2 -cd bleh -hg commit -m commit-11 . -hg commit -m commit-12 ../dir ../dir2 -hg -v commit -m commit-13 ../dir -cd .. - -hg commit -m commit-14 does-not-exist -ln -s foo baz -hg commit -m commit-15 baz -touch quux -hg commit -m commit-16 quux -echo >> dir/file -hg -v commit -m commit-17 dir/file -# An empty date was interpreted as epoch origin -echo foo >> foo -hg commit -d '' -m commit-no-date -hg tip --template '{date|isodate}\n' | grep '1970' -cd .. - -echo % partial subdir commit test -hg init test2 -cd test2 -mkdir foo -echo foo > foo/foo -mkdir bar -echo bar > bar/bar -hg add -hg ci -d '1000000 0' -m commit-subdir-1 foo -hg ci -d '1000001 0' -m commit-subdir-2 bar -echo % subdir log 1 -hg log -v foo -echo % subdir log 2 -hg log -v bar -echo % full log -hg log -v -cd .. - -echo % dot and subdir commit test -hg init test3 -cd test3 -mkdir foo -echo foo content > foo/plain-file -hg add foo/plain-file -hg ci -d '1000000 0' -m commit-foo-subdir foo -echo modified foo content > foo/plain-file -hg ci -d '2000000 0' -m commit-foo-dot . -echo % full log -hg log -v -echo % subdir log -cd foo -hg log . -cd .. -cd .. - -cd .. -hg init issue1049 -cd issue1049 -echo a > a -hg ci -Ama -echo a >> a -hg ci -mb -hg up 0 -echo b >> a -hg ci -mc -HGMERGE=true hg merge -echo % should fail because we are specifying a file name -hg ci -mmerge a -echo % should fail because we are specifying a pattern -hg ci -mmerge -I a -echo % should succeed -hg ci -mmerge -cd .. - - -echo % test commit message content -hg init commitmsg -cd commitmsg -echo changed > changed -echo removed > removed -hg ci -qAm init - -hg rm removed -echo changed >> changed -echo added > added -hg add added -HGEDITOR=cat hg ci -A -cd .. - -exit 0
--- a/tests/test-commit-copy Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh - -hg init dir -cd dir -echo bleh > bar -hg add bar -hg ci -m 'add bar' - -hg cp bar foo -echo >> bar -hg ci -m 'cp bar foo; change bar' - -hg debugrename foo -hg debugindex .hg/store/data/bar.i
--- a/tests/test-commit-copy.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 - rev offset length base linkrev nodeid p1 p2 - 0 0 6 0 0 26d3ca0dfd18 000000000000 000000000000 - 1 6 7 1 1 d267bddd54f7 26d3ca0dfd18 000000000000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-commit-copy.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,16 @@ + $ hg init dir + $ cd dir + $ echo bleh > bar + $ hg add bar + $ hg ci -m 'add bar' + + $ hg cp bar foo + $ echo >> bar + $ hg ci -m 'cp bar foo; change bar' + + $ hg debugrename foo + foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 + $ hg debugindex .hg/store/data/bar.i + rev offset length base linkrev nodeid p1 p2 + 0 0 6 0 0 26d3ca0dfd18 000000000000 000000000000 + 1 6 7 1 1 d267bddd54f7 26d3ca0dfd18 000000000000
--- a/tests/test-commit-unresolved Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH - -addcommit () { - echo $1 > $1 - hg add $1 - hg commit -d "${2} 0" -m $1 -} - -commit () { - hg commit -d "${2} 0" -m $1 -} - -hg init a -cd a -addcommit "A" 0 -addcommit "B" 1 -echo "C" >> A -commit "C" 2 - -hg update -C 0 -echo "D" >> A -commit "D" 3 - -echo -echo "% Merging a conflict araises" -hg merge - -echo -echo "% Correct the conflict without marking the file as resolved" -echo "ABCD" > A -hg commit -m "Merged" - -echo -echo "% Mark the conflict as resolved and commit" -hg resolve -m A -hg commit -m "Merged" - -exit 0
--- a/tests/test-commit-unresolved.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -created new head - -% Merging a conflict araises -merging A -warning: conflicts during merge. -merging A failed! -1 files updated, 0 files merged, 0 files removed, 1 files unresolved -use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon - -% Correct the conflict without marking the file as resolved -abort: unresolved merge conflicts (see hg resolve) - -% Mark the conflict as resolved and commit
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-commit-unresolved.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,47 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "graphlog=" >> $HGRCPATH + + $ addcommit () { + > echo $1 > $1 + > hg add $1 + > hg commit -d "${2} 0" -m $1 + > } + + $ commit () { + > hg commit -d "${2} 0" -m $1 + > } + + $ hg init a + $ cd a + $ addcommit "A" 0 + $ addcommit "B" 1 + $ echo "C" >> A + $ commit "C" 2 + + $ hg update -C 0 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo "D" >> A + $ commit "D" 3 + created new head + +Merging a conflict araises + + $ hg merge + merging A + warning: conflicts during merge. + merging A failed! + 1 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon + +Correct the conflict without marking the file as resolved + + $ echo "ABCD" > A + $ hg commit -m "Merged" + abort: unresolved merge conflicts (see hg resolve) + +Mark the conflict as resolved and commit + + $ hg resolve -m A + $ hg commit -m "Merged" + + $ exit 0
--- a/tests/test-commit.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -% commit date test -abort: empty commit message -abort: impossible time zone offset: 4444444 -abort: invalid date: '1\t15.1' -abort: invalid date: 'foo bar' -abort: date exceeds 32 bits: 111111111111 -% commit added file that has been deleted -nothing changed -abort: bar: file not found! -adding dir/file -dir/file -committed changeset 2:d2a76177cb42 -adding dir.file -abort: dir: no match under directory! -abort: bleh: no match under directory! -abort: dir2: no match under directory! -dir/file -committed changeset 3:1cd62a2d8db5 -abort: does-not-exist: No such file or directory -abort: baz: file not tracked! -abort: quux: file not tracked! -dir/file -committed changeset 4:49176991390e -% partial subdir commit test -adding bar/bar -adding foo/foo -% subdir log 1 -changeset: 0:6ef3cb06bb80 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -files: foo/foo -description: -commit-subdir-1 - - -% subdir log 2 -changeset: 1:f2e51572cf5a -tag: tip -user: test -date: Mon Jan 12 13:46:41 1970 +0000 -files: bar/bar -description: -commit-subdir-2 - - -% full log -changeset: 1:f2e51572cf5a -tag: tip -user: test -date: Mon Jan 12 13:46:41 1970 +0000 -files: bar/bar -description: -commit-subdir-2 - - -changeset: 0:6ef3cb06bb80 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -files: foo/foo -description: -commit-subdir-1 - - -% dot and subdir commit test -% full log -changeset: 1:d9180e04fa8a -tag: tip -user: test -date: Sat Jan 24 03:33:20 1970 +0000 -files: foo/plain-file -description: -commit-foo-dot - - -changeset: 0:80b572aaf098 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -files: foo/plain-file -description: -commit-foo-subdir - - -% subdir log -changeset: 1:d9180e04fa8a -tag: tip -user: test -date: Sat Jan 24 03:33:20 1970 +0000 -summary: commit-foo-dot - -changeset: 0:80b572aaf098 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit-foo-subdir - -adding a -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -merging a -0 files updated, 1 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -% should fail because we are specifying a file name -abort: cannot partially commit a merge (do not specify files or patterns) -% should fail because we are specifying a pattern -abort: cannot partially commit a merge (do not specify files or patterns) -% should succeed -% test commit message content - - -HG: Enter commit message. Lines beginning with 'HG:' are removed. -HG: Leave message empty to abort commit. -HG: -- -HG: user: test -HG: branch 'default' -HG: added added -HG: changed changed -HG: removed removed -abort: empty commit message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-commit.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,253 @@ +commit date test + + $ hg init test + $ cd test + $ echo foo > foo + $ hg add foo + $ HGEDITOR=true hg commit -m "" + abort: empty commit message + $ hg commit -d '0 0' -m commit-1 + $ echo foo >> foo + $ hg commit -d '1 4444444' -m commit-3 + abort: impossible time zone offset: 4444444 + $ hg commit -d '1 15.1' -m commit-4 + abort: invalid date: '1\t15.1' + $ hg commit -d 'foo bar' -m commit-5 + abort: invalid date: 'foo bar' + $ hg commit -d ' 1 4444' -m commit-6 + $ hg commit -d '111111111111 0' -m commit-7 + abort: date exceeds 32 bits: 111111111111 + +commit added file that has been deleted + + $ echo bar > bar + $ hg add bar + $ rm bar + $ hg commit -d "1000000 0" -m commit-8 + nothing changed + $ hg commit -d "1000000 0" -m commit-8-2 bar + abort: bar: file not found! + + $ hg -q revert -a --no-backup + + $ mkdir dir + $ echo boo > dir/file + $ hg add + adding dir/file + $ hg -v commit -m commit-9 dir + dir/file + committed changeset 2:d2a76177cb42 + + $ echo > dir.file + $ hg add + adding dir.file + $ hg commit -m commit-10 dir dir.file + abort: dir: no match under directory! + + $ echo >> dir/file + $ mkdir bleh + $ mkdir dir2 + $ cd bleh + $ hg commit -m commit-11 . + abort: bleh: no match under directory! + $ hg commit -m commit-12 ../dir ../dir2 + abort: dir2: no match under directory! + $ hg -v commit -m commit-13 ../dir + dir/file + committed changeset 3:1cd62a2d8db5 + $ cd .. + + $ hg commit -m commit-14 does-not-exist + abort: does-not-exist: No such file or directory + $ ln -s foo baz + $ hg commit -m commit-15 baz + abort: baz: file not tracked! + $ touch quux + $ hg commit -m commit-16 quux + abort: quux: file not tracked! + $ echo >> dir/file + $ hg -v commit -m commit-17 dir/file + dir/file + committed changeset 4:49176991390e + +An empty date was interpreted as epoch origin + + $ echo foo >> foo + $ hg commit -d '' -m commit-no-date + $ hg tip --template '{date|isodate}\n' | grep '1970' + $ cd .. + + +partial subdir commit test + + $ hg init test2 + $ cd test2 + $ mkdir foo + $ echo foo > foo/foo + $ mkdir bar + $ echo bar > bar/bar + $ hg add + adding bar/bar + adding foo/foo + $ hg ci -d '1000000 0' -m commit-subdir-1 foo + $ hg ci -d '1000001 0' -m commit-subdir-2 bar + +subdir log 1 + + $ hg log -v foo + changeset: 0:6ef3cb06bb80 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + files: foo/foo + description: + commit-subdir-1 + + + +subdir log 2 + + $ hg log -v bar + changeset: 1:f2e51572cf5a + tag: tip + user: test + date: Mon Jan 12 13:46:41 1970 +0000 + files: bar/bar + description: + commit-subdir-2 + + + +full log + + $ hg log -v + changeset: 1:f2e51572cf5a + tag: tip + user: test + date: Mon Jan 12 13:46:41 1970 +0000 + files: bar/bar + description: + commit-subdir-2 + + + changeset: 0:6ef3cb06bb80 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + files: foo/foo + description: + commit-subdir-1 + + + $ cd .. + + +dot and subdir commit test + + $ hg init test3 + $ cd test3 + $ mkdir foo + $ echo foo content > foo/plain-file + $ hg add foo/plain-file + $ hg ci -d '1000000 0' -m commit-foo-subdir foo + $ echo modified foo content > foo/plain-file + $ hg ci -d '2000000 0' -m commit-foo-dot . + +full log + + $ hg log -v + changeset: 1:d9180e04fa8a + tag: tip + user: test + date: Sat Jan 24 03:33:20 1970 +0000 + files: foo/plain-file + description: + commit-foo-dot + + + changeset: 0:80b572aaf098 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + files: foo/plain-file + description: + commit-foo-subdir + + + +subdir log + + $ cd foo + $ hg log . + changeset: 1:d9180e04fa8a + tag: tip + user: test + date: Sat Jan 24 03:33:20 1970 +0000 + summary: commit-foo-dot + + changeset: 0:80b572aaf098 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: commit-foo-subdir + + $ cd .. + $ cd .. + + $ cd .. + $ hg init issue1049 + $ cd issue1049 + $ echo a > a + $ hg ci -Ama + adding a + $ echo a >> a + $ hg ci -mb + $ hg up 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo b >> a + $ hg ci -mc + created new head + $ HGMERGE=true hg merge + merging a + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + +should fail because we are specifying a file name + + $ hg ci -mmerge a + abort: cannot partially commit a merge (do not specify files or patterns) + +should fail because we are specifying a pattern + + $ hg ci -mmerge -I a + abort: cannot partially commit a merge (do not specify files or patterns) + +should succeed + + $ hg ci -mmerge + $ cd .. + + +test commit message content + + $ hg init commitmsg + $ cd commitmsg + $ echo changed > changed + $ echo removed > removed + $ hg ci -qAm init + + $ hg rm removed + $ echo changed >> changed + $ echo added > added + $ hg add added + $ HGEDITOR=cat hg ci -A + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: added added + HG: changed changed + HG: removed removed + abort: empty commit message + $ cd .. + + $ exit 0
--- a/tests/test-committer Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#!/bin/sh - -unset HGUSER -EMAIL="My Name <myname@example.com>" -export EMAIL - -hg init test -cd test -touch asdf -hg add asdf -hg commit -d '1000000 0' -m commit-1 -hg tip - -unset EMAIL -echo 1234 > asdf -hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 -hg tip -echo "[ui]" >> .hg/hgrc -echo "username = foobar <foo@bar.com>" >> .hg/hgrc -echo 12 > asdf -hg commit -d '1000000 0' -m commit-1 -hg tip -echo 1 > asdf -hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 -hg tip -echo 123 > asdf -echo "[ui]" > .hg/hgrc -echo "username = " >> .hg/hgrc -hg commit -d '1000000 0' -m commit-1 -rm .hg/hgrc -hg commit -d '1000000 0' -m commit-1 2>&1 | sed -e "s/'[^']*'/user@host/" - -echo space > asdf -hg commit -d '1000000 0' -u ' ' -m commit-1 - -true
--- a/tests/test-committer.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -changeset: 0:9426b370c206 -tag: tip -user: My Name <myname@example.com> -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit-1 - -changeset: 1:4997f15a1b24 -tag: tip -user: foo@bar.com -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit-1 - -changeset: 2:72b8012b424e -tag: tip -user: foobar <foo@bar.com> -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit-1 - -changeset: 3:35ff3067bedd -tag: tip -user: foo@bar.com -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit-1 - -abort: no username supplied (see "hg help config") -No username found, using user@host instead -transaction abort! -rollback completed -abort: empty username!
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-committer.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,63 @@ + $ unset HGUSER + $ EMAIL="My Name <myname@example.com>" + $ export EMAIL + + $ hg init test + $ cd test + $ touch asdf + $ hg add asdf + $ hg commit -d '1000000 0' -m commit-1 + $ hg tip + changeset: 0:9426b370c206 + tag: tip + user: My Name <myname@example.com> + date: Mon Jan 12 13:46:40 1970 +0000 + summary: commit-1 + + + $ unset EMAIL + $ echo 1234 > asdf + $ hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 + $ hg tip + changeset: 1:4997f15a1b24 + tag: tip + user: foo@bar.com + date: Mon Jan 12 13:46:40 1970 +0000 + summary: commit-1 + + $ echo "[ui]" >> .hg/hgrc + $ echo "username = foobar <foo@bar.com>" >> .hg/hgrc + $ echo 12 > asdf + $ hg commit -d '1000000 0' -m commit-1 + $ hg tip + changeset: 2:72b8012b424e + tag: tip + user: foobar <foo@bar.com> + date: Mon Jan 12 13:46:40 1970 +0000 + summary: commit-1 + + $ echo 1 > asdf + $ hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 + $ hg tip + changeset: 3:35ff3067bedd + tag: tip + user: foo@bar.com + date: Mon Jan 12 13:46:40 1970 +0000 + summary: commit-1 + + $ echo 123 > asdf + $ echo "[ui]" > .hg/hgrc + $ echo "username = " >> .hg/hgrc + $ hg commit -d '1000000 0' -m commit-1 + abort: no username supplied (see "hg help config") + $ rm .hg/hgrc + $ hg commit -d '1000000 0' -m commit-1 2>&1 + No username found, using '[^']*' instead + + $ echo space > asdf + $ hg commit -d '1000000 0' -u ' ' -m commit-1 + transaction abort! + rollback completed + abort: empty username! + + $ true
--- a/tests/test-conflict Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh - -hg init -echo "nothing" > a -hg add a -hg commit -m ancestor -d "1000000 0" -echo "something" > a -hg commit -m branch1 -d "1000000 0" -hg co 0 -echo "something else" > a -hg commit -m branch2 -d "1000000 0" -hg merge 1 -hg id -cat a -hg status
--- a/tests/test-conflict.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -merging a -warning: conflicts during merge. -merging a failed! -0 files updated, 0 files merged, 0 files removed, 1 files unresolved -use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon -e7fe8eb3e180+0d24b7662d3e+ tip -<<<<<<< local -something else -======= -something ->>>>>>> other -M a -? a.orig
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-conflict.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,32 @@ + $ hg init + $ echo "nothing" > a + $ hg add a + $ hg commit -m ancestor -d "1000000 0" + $ echo "something" > a + $ hg commit -m branch1 -d "1000000 0" + $ hg co 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo "something else" > a + $ hg commit -m branch2 -d "1000000 0" + created new head + + $ hg merge 1 + merging a + warning: conflicts during merge. + merging a failed! + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon + + $ hg id + e7fe8eb3e180+0d24b7662d3e+ tip + + $ cat a + <<<<<<< local + something else + ======= + something + >>>>>>> other + + $ hg status + M a + ? a.orig
--- a/tests/test-copy Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#!/bin/sh - -hg init -echo a > a -hg add a -hg commit -m "1" -d "1000000 0" -hg status -hg copy a b -hg status -hg sum -hg --debug commit -m "2" -d "1000000 0" -echo "we should see two history entries" -hg history -v -echo "we should see one log entry for a" -hg log a -echo "this should show a revision linked to changeset 0" -hg debugindex .hg/store/data/a.i -echo "we should see one log entry for b" -hg log b -echo "this should show a revision linked to changeset 1" -hg debugindex .hg/store/data/b.i - -echo "this should show the rename information in the metadata" -hg debugdata .hg/store/data/b.d 0 | head -3 | tail -2 - -$TESTDIR/md5sum.py .hg/store/data/b.i -hg cat b > bsum -$TESTDIR/md5sum.py bsum -hg cat a > asum -$TESTDIR/md5sum.py asum -hg verify
--- a/tests/test-copy.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -A b -parent: 0:33aaa84a386b tip - 1 -branch: default -commit: 1 copied -update: (current) -b - b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 -committed changeset 1:76973b01f66a012648546c979ea4c41de9e7d8cd -we should see two history entries -changeset: 1:76973b01f66a -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -files: b -description: -2 - - -changeset: 0:33aaa84a386b -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -files: a -description: -1 - - -we should see one log entry for a -changeset: 0:33aaa84a386b -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: 1 - -this should show a revision linked to changeset 0 - rev offset length base linkrev nodeid p1 p2 - 0 0 3 0 0 b789fdd96dc2 000000000000 000000000000 -we should see one log entry for b -changeset: 1:76973b01f66a -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: 2 - -this should show a revision linked to changeset 1 - rev offset length base linkrev nodeid p1 p2 - 0 0 65 0 1 37d9b5d994ea 000000000000 000000000000 -this should show the rename information in the metadata -copy: a -copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 -4999f120a3b88713bbefddd195cf5133 .hg/store/data/b.i -60b725f10c9c85c70d97880dfe8191b3 bsum -60b725f10c9c85c70d97880dfe8191b3 asum -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 2 changesets, 2 total revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-copy.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,91 @@ + $ hg init + $ echo a > a + $ hg add a + $ hg commit -m "1" -d "1000000 0" + $ hg status + $ hg copy a b + $ hg status + A b + $ hg sum + parent: 0:33aaa84a386b tip + 1 + branch: default + commit: 1 copied + update: (current) + $ hg --debug commit -m "2" -d "1000000 0" + b + b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 + committed changeset 1:76973b01f66a012648546c979ea4c41de9e7d8cd + +we should see two history entries + + $ hg history -v + changeset: 1:76973b01f66a + tag: tip + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + files: b + description: + 2 + + + changeset: 0:33aaa84a386b + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + files: a + description: + 1 + + + +we should see one log entry for a + + $ hg log a + changeset: 0:33aaa84a386b + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: 1 + + +this should show a revision linked to changeset 0 + + $ hg debugindex .hg/store/data/a.i + rev offset length base linkrev nodeid p1 p2 + 0 0 3 0 0 b789fdd96dc2 000000000000 000000000000 + +we should see one log entry for b + + $ hg log b + changeset: 1:76973b01f66a + tag: tip + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: 2 + + +this should show a revision linked to changeset 1 + + $ hg debugindex .hg/store/data/b.i + rev offset length base linkrev nodeid p1 p2 + 0 0 65 0 1 37d9b5d994ea 000000000000 000000000000 + +this should show the rename information in the metadata + + $ hg debugdata .hg/store/data/b.d 0 | head -3 | tail -2 + copy: a + copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 + + $ $TESTDIR/md5sum.py .hg/store/data/b.i + 4999f120a3b88713bbefddd195cf5133 .hg/store/data/b.i + $ hg cat b > bsum + $ $TESTDIR/md5sum.py bsum + 60b725f10c9c85c70d97880dfe8191b3 bsum + $ hg cat a > asum + $ $TESTDIR/md5sum.py asum + 60b725f10c9c85c70d97880dfe8191b3 asum + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 2 changesets, 2 total revisions
--- a/tests/test-flags Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#!/bin/sh -e - -umask 027 -mkdir test1 -cd test1 - -hg init -touch a b -hg add a b -hg ci -m "added a b" -d "1000000 0" - -cd .. -hg clone test1 test3 -mkdir test2 -cd test2 - -hg init -hg pull ../test1 -hg co -chmod +x a -hg ci -m "chmod +x a" -d "1000000 0" -echo % the changelog should mention file a: -hg tip --template '{files}\n' - -cd ../test1 -echo 123 >>a -hg ci -m "a updated" -d "1000000 0" - -hg pull ../test2 -hg heads -hg history - -hg -v merge - -cd ../test3 -echo 123 >>b -hg ci -m "b updated" -d "1000000 0" - -hg pull ../test2 -hg heads -hg history - -hg -v merge - -ls -l ../test[123]/a > foo -cut -b 1-10 < foo - -hg debugindex .hg/store/data/a.i -hg debugindex ../test2/.hg/store/data/a.i -hg debugindex ../test1/.hg/store/data/a.i
--- a/tests/test-flags.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -pulling from ../test1 -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -(run 'hg update' to get a working copy) -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -% the changelog should mention file a: -a -pulling from ../test2 -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 0 changes to 0 files (+1 heads) -(run 'hg heads' to see heads, 'hg merge' to merge) -changeset: 2:37dccb76c058 -tag: tip -parent: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: chmod +x a - -changeset: 1:a187cb361a5a -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: a updated - -changeset: 2:37dccb76c058 -tag: tip -parent: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: chmod +x a - -changeset: 1:a187cb361a5a -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: a updated - -changeset: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: added a b - -resolving manifests -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -pulling from ../test2 -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 0 changes to 0 files (+1 heads) -(run 'hg heads' to see heads, 'hg merge' to merge) -changeset: 2:37dccb76c058 -tag: tip -parent: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: chmod +x a - -changeset: 1:d54568174d8e -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: b updated - -changeset: 2:37dccb76c058 -tag: tip -parent: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: chmod +x a - -changeset: 1:d54568174d8e -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: b updated - -changeset: 0:4536b1c2ca69 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: added a b - -resolving manifests -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) --rwxr-x--- --rwxr-x--- --rwxr-x--- - rev offset length base linkrev nodeid p1 p2 - 0 0 0 0 0 b80de5d13875 000000000000 000000000000 - rev offset length base linkrev nodeid p1 p2 - 0 0 0 0 0 b80de5d13875 000000000000 000000000000 - rev offset length base linkrev nodeid p1 p2 - 0 0 0 0 0 b80de5d13875 000000000000 000000000000 - 1 0 5 1 1 7fe919cc0336 b80de5d13875 000000000000
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-flags.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,149 @@ + $ umask 027 + $ mkdir test1 + $ cd test1 + + $ hg init + $ touch a b + $ hg add a b + $ hg ci -m "added a b" -d "1000000 0" + + $ cd .. + $ hg clone test1 test3 + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkdir test2 + $ cd test2 + + $ hg init + $ hg pull ../test1 + pulling from ../test1 + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + (run 'hg update' to get a working copy) + $ hg co + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ chmod +x a + $ hg ci -m "chmod +x a" -d "1000000 0" + +the changelog should mention file a: + + $ hg tip --template '{files}\n' + a + + $ cd ../test1 + $ echo 123 >>a + $ hg ci -m "a updated" -d "1000000 0" + + $ hg pull ../test2 + pulling from ../test2 + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 0 changes to 0 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + $ hg heads + changeset: 2:37dccb76c058 + tag: tip + parent: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: chmod +x a + + changeset: 1:a187cb361a5a + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: a updated + + $ hg history + changeset: 2:37dccb76c058 + tag: tip + parent: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: chmod +x a + + changeset: 1:a187cb361a5a + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: a updated + + changeset: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: added a b + + + $ hg -v merge + resolving manifests + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ cd ../test3 + $ echo 123 >>b + $ hg ci -m "b updated" -d "1000000 0" + + $ hg pull ../test2 + pulling from ../test2 + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 0 changes to 0 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + $ hg heads + changeset: 2:37dccb76c058 + tag: tip + parent: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: chmod +x a + + changeset: 1:d54568174d8e + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: b updated + + $ hg history + changeset: 2:37dccb76c058 + tag: tip + parent: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: chmod +x a + + changeset: 1:d54568174d8e + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: b updated + + changeset: 0:4536b1c2ca69 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: added a b + + + $ hg -v merge + resolving manifests + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + + $ ls -l ../test[123]/a > foo + $ cut -b 1-10 < foo + -rwxr-x--- + -rwxr-x--- + -rwxr-x--- + + $ hg debugindex .hg/store/data/a.i + rev offset length base linkrev nodeid p1 p2 + 0 0 0 0 0 b80de5d13875 000000000000 000000000000 + $ hg debugindex ../test2/.hg/store/data/a.i + rev offset length base linkrev nodeid p1 p2 + 0 0 0 0 0 b80de5d13875 000000000000 000000000000 + $ hg debugindex ../test1/.hg/store/data/a.i + rev offset length base linkrev nodeid p1 p2 + 0 0 0 0 0 b80de5d13875 000000000000 000000000000 + 1 0 5 1 1 7fe919cc0336 b80de5d13875 000000000000
--- a/tests/test-hook Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -#!/bin/sh - -cp "$TESTDIR"/printenv.py . - -# commit hooks can see env vars -hg init a -cd a -echo "[hooks]" > .hg/hgrc -echo 'commit = unset HG_LOCAL HG_TAG; python ../printenv.py commit' >> .hg/hgrc -echo 'commit.b = unset HG_LOCAL HG_TAG; python ../printenv.py commit.b' >> .hg/hgrc -echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python ../printenv.py precommit' >> .hg/hgrc -echo 'pretxncommit = unset HG_LOCAL HG_TAG; python ../printenv.py pretxncommit' >> .hg/hgrc -echo 'pretxncommit.tip = hg -q tip' >> .hg/hgrc -echo 'pre-identify = python ../printenv.py pre-identify 1' >> .hg/hgrc -echo 'pre-cat = python ../printenv.py pre-cat' >> .hg/hgrc -echo 'post-cat = python ../printenv.py post-cat' >> .hg/hgrc -echo a > a -hg add a -hg commit -m a -d "1000000 0" - -hg clone . ../b -cd ../b - -# changegroup hooks can see env vars -echo '[hooks]' > .hg/hgrc -echo 'prechangegroup = python ../printenv.py prechangegroup' >> .hg/hgrc -echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc -echo 'incoming = python ../printenv.py incoming' >> .hg/hgrc - -# pretxncommit and commit hooks can see both parents of merge -cd ../a -echo b >> a -hg commit -m a1 -d "1 0" -hg update -C 0 -echo b > b -hg add b -hg commit -m b -d '1 0' -hg merge 1 -hg commit -m merge -d '2 0' - -# test generic hooks -hg id -hg cat b - -cd ../b -hg pull ../a - -# tag hooks can see env vars -cd ../a -echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc -echo 'tag = unset HG_PARENT1 HG_PARENT2; python ../printenv.py tag' >> .hg/hgrc -hg tag -d '3 0' a -hg tag -l la - -# pretag hook can forbid tagging -echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc -hg tag -d '4 0' fa -hg tag -l fla - -# pretxncommit hook can see changeset, can roll back txn, changeset -# no more there after -echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc -echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc -echo z > z -hg add z -hg -q tip -hg commit -m 'fail' -d '4 0' -hg -q tip - -# precommit hook can prevent commit -echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc -hg commit -m 'fail' -d '4 0' -hg -q tip - -# preupdate hook can prevent update -echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc -hg update 1 - -# update hook -echo 'update = python ../printenv.py update' >> .hg/hgrc -hg update - -# prechangegroup hook can prevent incoming changes -cd ../b -hg -q tip -echo '[hooks]' > .hg/hgrc -echo 'prechangegroup.forbid = python ../printenv.py prechangegroup.forbid 1' >> .hg/hgrc -hg pull ../a - -# pretxnchangegroup hook can see incoming changes, can roll back txn, -# incoming changes no longer there after -echo '[hooks]' > .hg/hgrc -echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc -echo 'pretxnchangegroup.forbid1 = python ../printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc -hg pull ../a -hg -q tip - -# outgoing hooks can see env vars -rm .hg/hgrc -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing = python ../printenv.py preoutgoing' >> ../a/.hg/hgrc -echo 'outgoing = python ../printenv.py outgoing' >> ../a/.hg/hgrc -hg pull ../a -hg rollback - -# preoutgoing hook can prevent outgoing changes -echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc -hg pull ../a - -# outgoing hooks work for local clones -cd .. -echo '[hooks]' > a/.hg/hgrc -echo 'preoutgoing = python ../printenv.py preoutgoing' >> a/.hg/hgrc -echo 'outgoing = python ../printenv.py outgoing' >> a/.hg/hgrc -hg clone a c -rm -rf c - -# preoutgoing hook can prevent outgoing changes for local clones -echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc -hg clone a zzz -cd b - -cat > hooktests.py <<EOF -from mercurial import util - -uncallable = 0 - -def printargs(args): - args.pop('ui', None) - args.pop('repo', None) - a = list(args.items()) - a.sort() - print 'hook args:' - for k, v in a: - print ' ', k, v - -def passhook(**args): - printargs(args) - -def failhook(**args): - printargs(args) - return True - -class LocalException(Exception): - pass - -def raisehook(**args): - raise LocalException('exception from hook') - -def aborthook(**args): - raise util.Abort('raise abort from hook') - -def brokenhook(**args): - return 1 + {} - -class container: - unreachable = 1 -EOF - -echo '# test python hooks' -PYTHONPATH="`pwd`:$PYTHONPATH" -export PYTHONPATH - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc -hg pull ../a 2>&1 | grep 'raised an exception' - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc -hg pull ../a 2>&1 | grep 'raised an exception' - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc -hg pull ../a - -echo '[hooks]' > ../a/.hg/hgrc -echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc -hg pull ../a - -echo '# make sure --traceback works' -echo '[hooks]' > .hg/hgrc -echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc - -echo aa > a -hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' - -cd .. -hg init c -cd c - -cat > hookext.py <<EOF -def autohook(**args): - print "Automatically installed hook" - -def reposetup(ui, repo): - repo.ui.setconfig("hooks", "commit.auto", autohook) -EOF -echo '[extensions]' >> .hg/hgrc -echo 'hookext = hookext.py' >> .hg/hgrc - -touch foo -hg add foo -hg ci -d '0 0' -m 'add foo' -echo >> foo -hg ci --debug -d '0 0' -m 'change foo' | sed -e 's/ at .*>/>/' - -hg showconfig hooks | sed -e 's/ at .*>/>/' - -echo '# test python hook configured with python:[file]:[hook] syntax' -cd .. -mkdir d -cd d -hg init repo -mkdir hooks - -cd hooks -cat > testhooks.py <<EOF -def testhook(**args): - print 'hook works' -EOF -echo '[hooks]' > ../repo/.hg/hgrc -echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc - -cd ../repo -hg commit -d '0 0' - -cd ../../b -echo '# make sure --traceback works on hook import failure' -cat > importfail.py <<EOF -import somebogusmodule -# dereference something in the module to force demandimport to load it -somebogusmodule.whatever -EOF - -echo '[hooks]' > .hg/hgrc -echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc - -echo a >> a -hg --traceback commit -d '0 0' -ma 2>&1 | egrep '^(exception|Traceback|ImportError)' - -echo '# commit and update hooks should run after command completion (issue 1827)' -echo '[hooks]' > .hg/hgrc -echo 'commit = hg id' >> .hg/hgrc -echo 'update = hg id' >> .hg/hgrc -echo bb > a -hg ci -d '0 0' -ma -hg up 0 - -exit 0
--- a/tests/test-hook.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 -pretxncommit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$HGTMP/test-hook/a -0:29b62aeb769f -commit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 -commit.b hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -pretxncommit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook/a -1:b702efe96888 -commit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -commit.b hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -pretxncommit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook/a -2:1324a5531bac -commit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -commit.b hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b -created new head -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -precommit hook: HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 -pretxncommit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PENDING=$HGTMP/test-hook/a -3:4c52fb2e4022 -commit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 -commit.b hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 -pre-identify hook: HG_ARGS=id HG_OPTS={'tags': None, 'rev': '', 'num': None, 'branch': None, 'id': None} HG_PATS=[] -warning: pre-identify hook exited with status 1 -pre-cat hook: HG_ARGS=cat b HG_OPTS={'rev': '', 'decode': None, 'exclude': [], 'output': '', 'include': []} HG_PATS=['b'] -post-cat hook: HG_ARGS=cat b HG_OPTS={'rev': '', 'decode': None, 'exclude': [], 'output': '', 'include': []} HG_PATS=['b'] HG_RESULT=0 -b -prechangegroup hook: HG_SOURCE=pull HG_URL=file: -changegroup hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: -incoming hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: -incoming hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_SOURCE=pull HG_URL=file: -incoming hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_SOURCE=pull HG_URL=file: -pulling from ../a -searching for changes -adding changesets -adding manifests -adding file changes -added 3 changesets with 2 changes to 2 files -(run 'hg update' to get a working copy) -pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a -precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 -pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 HG_PENDING=$HGTMP/test-hook/a -4:8ea2ef7ad3e8 -commit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 -commit.b hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 -tag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a -pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la -tag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la -pretag hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa -pretag.forbid hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa -abort: pretag.forbid hook exited with status 1 -pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla -pretag.forbid hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla -abort: pretag.forbid hook exited with status 1 -4:8ea2ef7ad3e8 -precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 -pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook/a -5:fad284daf8c0 -5:fad284daf8c0 -pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook/a -transaction abort! -rollback completed -abort: pretxncommit.forbid1 hook exited with status 1 -4:8ea2ef7ad3e8 -precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 -precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 -abort: precommit.forbid hook exited with status 1 -4:8ea2ef7ad3e8 -preupdate hook: HG_PARENT1=b702efe96888 -0 files updated, 0 files merged, 2 files removed, 0 files unresolved -preupdate hook: HG_PARENT1=8ea2ef7ad3e8 -update hook: HG_ERROR=0 HG_PARENT1=8ea2ef7ad3e8 -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -3:4c52fb2e4022 -prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file: -pulling from ../a -searching for changes -abort: prechangegroup.forbid hook exited with status 1 -4:8ea2ef7ad3e8 -pretxnchangegroup.forbid hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook/b HG_SOURCE=pull HG_URL=file: -pulling from ../a -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -transaction abort! -rollback completed -abort: pretxnchangegroup.forbid1 hook exited with status 1 -3:4c52fb2e4022 -preoutgoing hook: HG_SOURCE=pull -outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull -pulling from ../a -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -(run 'hg update' to get a working copy) -rolling back to revision 3 (undo pull) -preoutgoing hook: HG_SOURCE=pull -preoutgoing.forbid hook: HG_SOURCE=pull -pulling from ../a -searching for changes -abort: preoutgoing.forbid hook exited with status 1 -preoutgoing hook: HG_SOURCE=clone -outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone -updating to branch default -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -preoutgoing hook: HG_SOURCE=clone -preoutgoing.forbid hook: HG_SOURCE=clone -abort: preoutgoing.forbid hook exited with status 1 -# test python hooks -error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' -error: preoutgoing.raise hook raised an exception: exception from hook -pulling from ../a -searching for changes -error: preoutgoing.abort hook failed: raise abort from hook -abort: raise abort from hook -pulling from ../a -searching for changes -hook args: - hooktype preoutgoing - source pull -abort: preoutgoing.fail hook failed -pulling from ../a -searching for changes -abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable) -pulling from ../a -searching for changes -abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined) -pulling from ../a -searching for changes -abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module) -pulling from ../a -searching for changes -abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed) -pulling from ../a -searching for changes -abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed) -pulling from ../a -searching for changes -hook args: - hooktype preoutgoing - source pull -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -(run 'hg update' to get a working copy) -# make sure --traceback works -Traceback (most recent call last): -Automatically installed hook -foo -calling hook commit.auto: <function autohook> -Automatically installed hook -committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 -hooks.commit.auto=<function autohook> -# test python hook configured with python:[file]:[hook] syntax -hook works -nothing changed -# make sure --traceback works on hook import failure -exception from first failed import attempt: -Traceback (most recent call last): -ImportError: No module named somebogusmodule -exception from second failed import attempt: -Traceback (most recent call last): -ImportError: No module named hgext_importfail -Traceback (most recent call last): -# commit and update hooks should run after command completion (issue 1827) -8da618c33484 tip -29b62aeb769f -1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-hook.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,465 @@ + $ cp "$TESTDIR"/printenv.py . + +# commit hooks can see env vars + + $ hg init a + $ cd a + $ echo "[hooks]" > .hg/hgrc + $ echo 'commit = unset HG_LOCAL HG_TAG; python ../printenv.py commit' >> .hg/hgrc + $ echo 'commit.b = unset HG_LOCAL HG_TAG; python ../printenv.py commit.b' >> .hg/hgrc + $ echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python ../printenv.py precommit' >> .hg/hgrc + $ echo 'pretxncommit = unset HG_LOCAL HG_TAG; python ../printenv.py pretxncommit' >> .hg/hgrc + $ echo 'pretxncommit.tip = hg -q tip' >> .hg/hgrc + $ echo 'pre-identify = python ../printenv.py pre-identify 1' >> .hg/hgrc + $ echo 'pre-cat = python ../printenv.py pre-cat' >> .hg/hgrc + $ echo 'post-cat = python ../printenv.py post-cat' >> .hg/hgrc + $ echo a > a + $ hg add a + $ hg commit -m a -d "1000000 0" + precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 + pretxncommit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$HGTMP/test-hook.t/a + 0:29b62aeb769f + commit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 + commit.b hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 + + $ hg clone . ../b + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../b + +# changegroup hooks can see env vars + + $ echo '[hooks]' > .hg/hgrc + $ echo 'prechangegroup = python ../printenv.py prechangegroup' >> .hg/hgrc + $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc + $ echo 'incoming = python ../printenv.py incoming' >> .hg/hgrc + +# pretxncommit and commit hooks can see both parents of merge + + $ cd ../a + $ echo b >> a + $ hg commit -m a1 -d "1 0" + precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + pretxncommit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook.t/a + 1:b702efe96888 + commit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + commit.b hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + $ hg update -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo b > b + $ hg add b + $ hg commit -m b -d '1 0' + precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + pretxncommit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=$HGTMP/test-hook.t/a + 2:1324a5531bac + commit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + commit.b hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b + created new head + $ hg merge 1 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg commit -m merge -d '2 0' + precommit hook: HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 + pretxncommit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PENDING=$HGTMP/test-hook.t/a + 3:4c52fb2e4022 + commit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 + commit.b hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 + +# test generic hooks + + $ hg id + pre-identify hook: HG_ARGS=id HG_OPTS={'tags': None, 'rev': '', 'num': None, 'branch': None, 'id': None} HG_PATS=[] + warning: pre-identify hook exited with status 1 + $ hg cat b + pre-cat hook: HG_ARGS=cat b HG_OPTS={'rev': '', 'decode': None, 'exclude': [], 'output': '', 'include': []} HG_PATS=['b'] + post-cat hook: HG_ARGS=cat b HG_OPTS={'rev': '', 'decode': None, 'exclude': [], 'output': '', 'include': []} HG_PATS=['b'] HG_RESULT=0 + b + + $ cd ../b + $ hg pull ../a + prechangegroup hook: HG_SOURCE=pull HG_URL=file: + changegroup hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: + incoming hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_SOURCE=pull HG_URL=file: + incoming hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_SOURCE=pull HG_URL=file: + incoming hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_SOURCE=pull HG_URL=file: + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 3 changesets with 2 changes to 2 files + (run 'hg update' to get a working copy) + +# tag hooks can see env vars + + $ cd ../a + $ echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc + $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python ../printenv.py tag' >> .hg/hgrc + $ hg tag -d '3 0' a + pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a + precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 + pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 HG_PENDING=$HGTMP/test-hook.t/a + 4:8ea2ef7ad3e8 + commit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 + commit.b hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 + tag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a + $ hg tag -l la + pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la + tag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=la + +# pretag hook can forbid tagging + + $ echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc + $ hg tag -d '4 0' fa + pretag hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa + pretag.forbid hook: HG_LOCAL=0 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fa + abort: pretag.forbid hook exited with status 1 + $ hg tag -l fla + pretag hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla + pretag.forbid hook: HG_LOCAL=1 HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_TAG=fla + abort: pretag.forbid hook exited with status 1 + +# pretxncommit hook can see changeset, can roll back txn, changeset +# no more there after + + $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc + $ echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc + $ echo z > z + $ hg add z + $ hg -q tip + 4:8ea2ef7ad3e8 + $ hg commit -m 'fail' -d '4 0' + precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 + pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/a + 5:fad284daf8c0 + 5:fad284daf8c0 + pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/a + transaction abort! + rollback completed + abort: pretxncommit.forbid1 hook exited with status 1 + $ hg -q tip + 4:8ea2ef7ad3e8 + +# precommit hook can prevent commit + + $ echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc + $ hg commit -m 'fail' -d '4 0' + precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 + precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 + abort: precommit.forbid hook exited with status 1 + $ hg -q tip + 4:8ea2ef7ad3e8 + +# preupdate hook can prevent update + + $ echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc + $ hg update 1 + preupdate hook: HG_PARENT1=b702efe96888 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + +# update hook + + $ echo 'update = python ../printenv.py update' >> .hg/hgrc + $ hg update + preupdate hook: HG_PARENT1=8ea2ef7ad3e8 + update hook: HG_ERROR=0 HG_PARENT1=8ea2ef7ad3e8 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +# prechangegroup hook can prevent incoming changes + + $ cd ../b + $ hg -q tip + 3:4c52fb2e4022 + $ echo '[hooks]' > .hg/hgrc + $ echo 'prechangegroup.forbid = python ../printenv.py prechangegroup.forbid 1' >> .hg/hgrc + $ hg pull ../a + prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file: + pulling from ../a + searching for changes + abort: prechangegroup.forbid hook exited with status 1 + +# pretxnchangegroup hook can see incoming changes, can roll back txn, +# incoming changes no longer there after + + $ echo '[hooks]' > .hg/hgrc + $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc + $ echo 'pretxnchangegroup.forbid1 = python ../printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc + $ hg pull ../a + 4:8ea2ef7ad3e8 + pretxnchangegroup.forbid hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=$HGTMP/test-hook.t/b HG_SOURCE=pull HG_URL=file: + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + transaction abort! + rollback completed + abort: pretxnchangegroup.forbid1 hook exited with status 1 + $ hg -q tip + 3:4c52fb2e4022 + +# outgoing hooks can see env vars + + $ rm .hg/hgrc + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> ../a/.hg/hgrc + $ echo 'outgoing = python ../printenv.py outgoing' >> ../a/.hg/hgrc + $ hg pull ../a + preoutgoing hook: HG_SOURCE=pull + outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull + pulling from ../a + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + $ hg rollback + rolling back to revision 3 (undo pull) + +# preoutgoing hook can prevent outgoing changes + + $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc + $ hg pull ../a + preoutgoing hook: HG_SOURCE=pull + preoutgoing.forbid hook: HG_SOURCE=pull + pulling from ../a + searching for changes + abort: preoutgoing.forbid hook exited with status 1 + +# outgoing hooks work for local clones + + $ cd .. + $ echo '[hooks]' > a/.hg/hgrc + $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> a/.hg/hgrc + $ echo 'outgoing = python ../printenv.py outgoing' >> a/.hg/hgrc + $ hg clone a c + preoutgoing hook: HG_SOURCE=clone + outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ rm -rf c + +# preoutgoing hook can prevent outgoing changes for local clones + + $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc + $ hg clone a zzz + preoutgoing hook: HG_SOURCE=clone + preoutgoing.forbid hook: HG_SOURCE=clone + abort: preoutgoing.forbid hook exited with status 1 + $ cd b + + $ cat > hooktests.py <<EOF + > from mercurial import util + > + > uncallable = 0 + > + > def printargs(args): + > args.pop('ui', None) + > args.pop('repo', None) + > a = list(args.items()) + > a.sort() + > print 'hook args:' + > for k, v in a: + > print ' ', k, v + > + > def passhook(**args): + > printargs(args) + > + > def failhook(**args): + > printargs(args) + > return True + > + > class LocalException(Exception): + > pass + > + > def raisehook(**args): + > raise LocalException('exception from hook') + > + > def aborthook(**args): + > raise util.Abort('raise abort from hook') + > + > def brokenhook(**args): + > return 1 + {} + > + > class container: + > unreachable = 1 + > EOF + +# test python hooks + + $ PYTHONPATH="`pwd`:$PYTHONPATH" + $ export PYTHONPATH + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc + $ hg pull ../a 2>&1 | grep 'raised an exception' + error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc + $ hg pull ../a 2>&1 | grep 'raised an exception' + error: preoutgoing.raise hook raised an exception: exception from hook + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + error: preoutgoing.abort hook failed: raise abort from hook + abort: raise abort from hook + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + hook args: + hooktype preoutgoing + source pull + abort: preoutgoing.fail hook failed + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable) + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined) + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module) + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed) + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed) + + $ echo '[hooks]' > ../a/.hg/hgrc + $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc + $ hg pull ../a + pulling from ../a + searching for changes + hook args: + hooktype preoutgoing + source pull + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + +# make sure --traceback works + + $ echo '[hooks]' > .hg/hgrc + $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc + + $ echo aa > a + $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' + Traceback (most recent call last): + + $ cd .. + $ hg init c + $ cd c + + $ cat > hookext.py <<EOF + > def autohook(**args): + > print "Automatically installed hook" + > + > def reposetup(ui, repo): + > repo.ui.setconfig("hooks", "commit.auto", autohook) + > EOF + $ echo '[extensions]' >> .hg/hgrc + $ echo 'hookext = hookext.py' >> .hg/hgrc + + $ touch foo + $ hg add foo + $ hg ci -d '0 0' -m 'add foo' + Automatically installed hook + $ echo >> foo + $ hg ci --debug -d '0 0' -m 'change foo' + foo + calling hook commit.auto: <function autohook at .*> + Automatically installed hook + committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 + + $ hg showconfig hooks + hooks.commit.auto=<function autohook at .*> + +# test python hook configured with python:[file]:[hook] syntax + + $ cd .. + $ mkdir d + $ cd d + $ hg init repo + $ mkdir hooks + + $ cd hooks + $ cat > testhooks.py <<EOF + > def testhook(**args): + > print 'hook works' + > EOF + $ echo '[hooks]' > ../repo/.hg/hgrc + $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc + + $ cd ../repo + $ hg commit -d '0 0' + hook works + nothing changed + + $ cd ../../b + +# make sure --traceback works on hook import failure + + $ cat > importfail.py <<EOF + > import somebogusmodule + > # dereference something in the module to force demandimport to load it + > somebogusmodule.whatever + > EOF + + $ echo '[hooks]' > .hg/hgrc + $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc + + $ echo a >> a + $ hg --traceback commit -d '0 0' -ma 2>&1 | egrep '^(exception|Traceback|ImportError)' + exception from first failed import attempt: + Traceback (most recent call last): + ImportError: No module named somebogusmodule + exception from second failed import attempt: + Traceback (most recent call last): + ImportError: No module named hgext_importfail + Traceback (most recent call last): + +# commit and update hooks should run after command completion (issue 1827) + + $ echo '[hooks]' > .hg/hgrc + $ echo 'commit = hg id' >> .hg/hgrc + $ echo 'update = hg id' >> .hg/hgrc + $ echo bb > a + $ hg ci -d '0 0' -ma + 8da618c33484 tip + $ hg up 0 + 29b62aeb769f + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ exit 0
--- a/tests/test-identify Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -#!/bin/sh - -"$TESTDIR/hghave" no-outer-repo || exit 80 - -echo % no repo -hg id - -echo % create repo -hg init test -cd test -echo a > a -hg ci -Ama - -echo % basic id usage -hg id -hg id --debug -hg id -q -hg id -v - -echo % with options -hg id -r. -hg id -n -hg id -t -hg id -b -hg id -i -hg id -n -t -b -i - -echo % with modifications -echo b > a -hg id -n -t -b -i - -echo % other local repo -cd .. -hg -R test id -hg id test - -echo % with remote http repo -cd test -hg serve -p $HGPORT1 -d --pid-file=hg.pid -cat hg.pid >> $DAEMON_PIDS -hg id http://localhost:$HGPORT1/ - -echo % remote with tags? -hg id -t http://localhost:$HGPORT1/ - -true # ends with util.Abort -> returns 255
--- a/tests/test-identify.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -% no repo -abort: There is no Mercurial repository here (.hg not found) -% create repo -adding a -% basic id usage -cb9a9f314b8b tip -cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b tip -cb9a9f314b8b -cb9a9f314b8b tip -% with options -cb9a9f314b8b tip -0 -tip -default -cb9a9f314b8b -cb9a9f314b8b 0 default tip -% with modifications -cb9a9f314b8b+ 0+ default tip -% other local repo -cb9a9f314b8b+ tip -cb9a9f314b8b+ tip -% with remote http repo -cb9a9f314b8b -% remote with tags? -abort: can't query remote revision number, branch, or tags
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-identify.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,69 @@ + $ "$TESTDIR/hghave" no-outer-repo || exit 80 + +no repo + + $ hg id + abort: There is no Mercurial repository here (.hg not found) + +create repo + + $ hg init test + $ cd test + $ echo a > a + $ hg ci -Ama + adding a + +basic id usage + + $ hg id + cb9a9f314b8b tip + $ hg id --debug + cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b tip + $ hg id -q + cb9a9f314b8b + $ hg id -v + cb9a9f314b8b tip + +with options + + $ hg id -r. + cb9a9f314b8b tip + $ hg id -n + 0 + $ hg id -t + tip + $ hg id -b + default + $ hg id -i + cb9a9f314b8b + $ hg id -n -t -b -i + cb9a9f314b8b 0 default tip + +with modifications + + $ echo b > a + $ hg id -n -t -b -i + cb9a9f314b8b+ 0+ default tip + +other local repo + + $ cd .. + $ hg -R test id + cb9a9f314b8b+ tip + $ hg id test + cb9a9f314b8b+ tip + +with remote http repo + + $ cd test + $ hg serve -p $HGPORT1 -d --pid-file=hg.pid + $ cat hg.pid >> $DAEMON_PIDS + $ hg id http://localhost:$HGPORT1/ + cb9a9f314b8b + +remote with tags? + + $ hg id -t http://localhost:$HGPORT1/ + abort: can't query remote revision number, branch, or tags + + $ true # ends with util.Abort -> returns 255
--- a/tests/test-import Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,497 +0,0 @@ -#!/bin/sh - -hg init a -mkdir a/d1 -mkdir a/d1/d2 -echo line 1 > a/a -echo line 1 > a/d1/d2/a -hg --cwd a ci -Ama - -echo line 2 >> a/a -hg --cwd a ci -u someone -d '1 0' -m'second change' - -echo % import exported patch -hg clone -r0 a b -hg --cwd a export tip > tip.patch -hg --cwd b import ../tip.patch -echo % message should be same -hg --cwd b tip | grep 'second change' -echo % committer should be same -hg --cwd b tip | grep someone -rm -r b - -echo % import exported patch with external patcher -cat > dummypatch.py <<EOF -print 'patching file a' -file('a', 'wb').write('line2\n') -EOF -chmod +x dummypatch.py -hg clone -r0 a b -hg --cwd a export tip > tip.patch -hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch -cat b/a -rm -r b - -echo % import of plain diff should fail without message -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -hg --cwd b import ../tip.patch -rm -r b - -echo % import of plain diff should be ok with message -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -hg --cwd b import -mpatch ../tip.patch -rm -r b - -echo % import of plain diff with specific date and user -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch -hg -R b tip -pv -rm -r b - -echo % import of plain diff should be ok with --no-commit -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -hg --cwd b import --no-commit ../tip.patch -hg --cwd b diff --nodates -rm -r b - -echo % hg -R repo import -# put the clone in a subdir - having a directory named "a" -# used to hide a bug. -mkdir dir -hg clone -r0 a dir/b -hg --cwd a export tip > dir/tip.patch -cd dir -hg -R b import tip.patch -cd .. -rm -r dir - -echo % import from stdin -hg clone -r0 a b -hg --cwd a export tip | hg --cwd b import - -rm -r b - -echo % import two patches in one stream -hg init b -hg --cwd a export 0:tip | hg --cwd b import - -hg --cwd a id -hg --cwd b id -rm -r b - -echo % override commit message -hg clone -r0 a b -hg --cwd a export tip | hg --cwd b import -m 'override' - -hg --cwd b tip | grep override -rm -r b - -cat > mkmsg.py <<EOF -import email.Message, sys -msg = email.Message.Message() -msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) -msg['Subject'] = 'email patch' -msg['From'] = 'email patcher' -sys.stdout.write(msg.as_string()) -EOF - -echo % plain diff in email, subject, message body -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -python mkmsg.py > msg.patch -hg --cwd b import ../msg.patch -hg --cwd b tip | grep email -rm -r b - -echo % plain diff in email, no subject, message body -hg clone -r0 a b -grep -v '^Subject:' msg.patch | hg --cwd b import - -rm -r b - -echo % plain diff in email, subject, no message body -hg clone -r0 a b -grep -v '^email ' msg.patch | hg --cwd b import - -rm -r b - -echo % plain diff in email, no subject, no message body, should fail -hg clone -r0 a b -egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - -rm -r b - -echo % hg export in email, should use patch header -hg clone -r0 a b -hg --cwd a export tip > tip.patch -python mkmsg.py | hg --cwd b import - -hg --cwd b tip | grep second -rm -r b - -# subject: duplicate detection, removal of [PATCH] -# The '---' tests the gitsendmail handling without proper mail headers -cat > mkmsg2.py <<EOF -import email.Message, sys -msg = email.Message.Message() -msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) -msg['Subject'] = '[PATCH] email patch' -msg['From'] = 'email patcher' -sys.stdout.write(msg.as_string()) -EOF - -echo '% plain diff in email, [PATCH] subject, message body with subject' -hg clone -r0 a b -hg --cwd a diff -r0:1 > tip.patch -python mkmsg2.py | hg --cwd b import - -hg --cwd b tip --template '{desc}\n' -rm -r b - -# We weren't backing up the correct dirstate file when importing many patches -# (issue963) -echo '% import patch1 patch2; rollback' -echo line 3 >> a/a -hg --cwd a ci -m'third change' -hg --cwd a export -o '../patch%R' 1 2 -hg clone -qr0 a b -hg --cwd b parents --template 'parent: {rev}\n' -hg --cwd b import ../patch1 ../patch2 -hg --cwd b rollback -hg --cwd b parents --template 'parent: {rev}\n' -rm -r b - -# bug non regression test -# importing a patch in a subdirectory failed at the commit stage -echo line 2 >> a/d1/d2/a -hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' -echo % hg import in a subdirectory -hg clone -r0 a b -hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch -dir=`pwd` -cd b/d1/d2 2>&1 > /dev/null -hg import ../../../tip.patch -cd "$dir" -echo "% message should be 'subdir change'" -hg --cwd b tip | grep 'subdir change' -echo "% committer should be 'someoneelse'" -hg --cwd b tip | grep someoneelse -echo "% should be empty" -hg --cwd b status - - -# Test fuzziness (ambiguous patch location, fuzz=2) -echo % test fuzziness -hg init fuzzy -cd fuzzy -echo line1 > a -echo line0 >> a -echo line3 >> a -hg ci -Am adda -echo line1 > a -echo line2 >> a -echo line0 >> a -echo line3 >> a -hg ci -m change a -hg export tip > tip.patch -hg up -C 0 -echo line1 > a -echo line0 >> a -echo line1 >> a -echo line0 >> a -hg ci -m brancha -hg import --no-commit -v tip.patch -hg revert -a -echo '% test fuzziness with eol=auto' -hg --config patch.eol=auto import --no-commit -v tip.patch -cd .. - -# Test hunk touching empty files (issue906) -hg init empty -cd empty -touch a -touch b1 -touch c1 -echo d > d -hg ci -Am init -echo a > a -echo b > b1 -hg mv b1 b2 -echo c > c1 -hg copy c1 c2 -rm d -touch d -hg diff --git -hg ci -m empty -hg export --git tip > empty.diff -hg up -C 0 -hg import empty.diff -for name in a b1 b2 c1 c2 d; -do - echo % $name file - test -f $name && cat $name -done -cd .. - -# Test importing a patch ending with a binary file removal -echo % test trailing binary removal -hg init binaryremoval -cd binaryremoval -echo a > a -python -c "file('b', 'wb').write('a\x00b')" -hg ci -Am addall -hg rm a -hg rm b -hg st -hg ci -m remove -hg export --git . > remove.diff -cat remove.diff | grep git -hg up -C 0 -hg import remove.diff -hg manifest -cd .. - -echo % 'test update+rename with common name (issue 927)' -hg init t -cd t -touch a -hg ci -Am t -echo a > a -# Here, bfile.startswith(afile) -hg copy a a2 -hg ci -m copya -hg export --git tip > copy.diff -hg up -C 0 -hg import copy.diff -echo % view a -# a should contain an 'a' -cat a -echo % view a2 -# and a2 should have duplicated it -cat a2 -cd .. - -echo % 'test -p0' -hg init p0 -cd p0 -echo a > a -hg ci -Am t -hg import -p0 - << EOF -foobar ---- a Sat Apr 12 22:43:58 2008 -0400 -+++ a Sat Apr 12 22:44:05 2008 -0400 -@@ -1,1 +1,1 @@ --a -+bb -EOF -hg status -cat a -cd .. - -echo % 'test paths outside repo root' -mkdir outside -touch outside/foo -hg init inside -cd inside -hg import - <<EOF -diff --git a/a b/b -rename from ../outside/foo -rename to bar -EOF -cd .. - -echo '% test import with similarity and git and strip (issue295 et al.)' -hg init sim -cd sim -echo 'this is a test' > a -hg ci -Ama -cat > ../rename.diff <<EOF -diff --git a/foo/a b/foo/a -deleted file mode 100644 ---- a/foo/a -+++ /dev/null -@@ -1,1 +0,0 @@ --this is a test -diff --git a/foo/b b/foo/b -new file mode 100644 ---- /dev/null -+++ b/foo/b -@@ -0,0 +1,2 @@ -+this is a test -+foo -EOF -hg import --no-commit -v -s 1 ../rename.diff -p2 -hg st -C -hg revert -a -rm b -hg import --no-commit -v -s 100 ../rename.diff -p2 -hg st -C -cd .. - - -echo '% add empty file from the end of patch (issue 1495)' -hg init addemptyend -cd addemptyend -touch a -hg addremove -hg ci -m "commit" -cat > a.patch <<EOF -diff --git a/a b/a ---- a/a -+++ b/a -@@ -0,0 +1,1 @@ -+a -diff --git a/b b/b -new file mode 100644 -EOF -hg import --no-commit a.patch -cd .. - -echo '% create file when source is not /dev/null' -cat > create.patch <<EOF -diff -Naur proj-orig/foo proj-new/foo ---- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 -+++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 -@@ -0,0 +1,1 @@ -+a -EOF -# some people have patches like the following too -cat > create2.patch <<EOF -diff -Naur proj-orig/foo proj-new/foo ---- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 -+++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 -@@ -0,0 +1,1 @@ -+a -EOF -hg init oddcreate -cd oddcreate -hg import --no-commit ../create.patch -cat foo -rm foo -hg revert foo -hg import --no-commit ../create2.patch -cat foo - -echo % 'first line mistaken for email headers (issue 1859)' -hg init emailconfusion -cd emailconfusion -cat > a.patch <<EOF -module: summary - -description - - -diff -r 000000000000 -r 9b4c1e343b55 test.txt ---- /dev/null -+++ b/a -@@ -0,0 +1,1 @@ -+a -EOF -hg import -d '0 0' a.patch -hg parents -v -cd .. - -echo % '--- in commit message' -hg init commitconfusion -cd commitconfusion -cat > a.patch <<EOF -module: summary - ---- description - -diff --git a/a b/a -new file mode 100644 ---- /dev/null -+++ b/a -@@ -0,0 +1,1 @@ -+a -EOF -hg import -d '0 0' a.patch -hg parents -v -cd .. - -echo '% tricky header splitting' -cat > trickyheaders.patch <<EOF -From: User A <user@a> -Subject: [PATCH] from: tricky! - -# HG changeset patch -# User User B -# Date 1266264441 18000 -# Branch stable -# Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 -# Parent 0000000000000000000000000000000000000000 -from: tricky! - -That is not a header. - -diff -r 000000000000 -r f2be6a1170ac foo ---- /dev/null -+++ b/foo -@@ -0,0 +1,1 @@ -+foo -EOF - -hg init trickyheaders -cd trickyheaders -hg import -d '0 0' ../trickyheaders.patch -hg export --git tip -cd .. - -echo '% issue2102' -hg init issue2102 -cd issue2102 -mkdir -p src/cmd/gc -touch src/cmd/gc/mksys.bash -hg ci -Am init -hg import - <<EOF -# HG changeset patch -# User Rob Pike -# Date 1216685449 25200 -# Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 -# Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 -help management of empty pkg and lib directories in perforce - -R=gri -DELTA=4 (4 added, 0 deleted, 0 changed) -OCL=13328 -CL=13328 - -diff --git a/lib/place-holder b/lib/place-holder -new file mode 100644 ---- /dev/null -+++ b/lib/place-holder -@@ -0,0 +1,2 @@ -+perforce does not maintain empty directories. -+this file helps. -diff --git a/pkg/place-holder b/pkg/place-holder -new file mode 100644 ---- /dev/null -+++ b/pkg/place-holder -@@ -0,0 +1,2 @@ -+perforce does not maintain empty directories. -+this file helps. -diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash -old mode 100644 -new mode 100755 -EOF -hg sum -hg diff --git -c tip -cd .. - -echo '% diff lines looking like headers' -hg init difflineslikeheaders -cd difflineslikeheaders -echo a >a -echo b >b -echo c >c -hg ci -Am1 - -echo "key: value" >>a -echo "key: value" >>b -echo "foo" >>c -hg ci -m2 - -hg up -C 0 -hg diff --git -c1 >want -hg diff -c1 | hg import --no-commit - -hg diff --git >have -diff want have -cd .. -
--- a/tests/test-import-eol Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -#!/bin/sh - -cat > makepatch.py <<EOF -f = file('eol.diff', 'wb') -w = f.write -w('test message\n') -w('diff --git a/a b/a\n') -w('--- a/a\n') -w('+++ b/a\n') -w('@@ -1,5 +1,5 @@\n') -w(' a\n') -w('-bbb\r\n') -w('+yyyy\r\n') -w(' cc\r\n') -w(' \n') -w(' d\n') -w('-e\n') -w('\ No newline at end of file\n') -w('+z\r\n') -w('\ No newline at end of file\r\n') -EOF - -hg init repo -cd repo -echo '\.diff' > .hgignore - -# Test different --eol values -python -c 'file("a", "wb").write("a\nbbb\ncc\n\nd\ne")' -hg ci -Am adda -python ../makepatch.py - -echo % invalid eol -hg --config patch.eol='LFCR' import eol.diff -hg revert -a - -echo % force LF -hg --traceback --config patch.eol='LF' import eol.diff -python -c 'print repr(file("a","rb").read())' -hg st - -echo % force CRLF -hg up -C 0 -hg --traceback --config patch.eol='CRLF' import eol.diff -python -c 'print repr(file("a","rb").read())' -hg st - -echo % auto EOL on LF file -hg up -C 0 -hg --traceback --config patch.eol='auto' import eol.diff -python -c 'print repr(file("a","rb").read())' -hg st - -echo % auto EOL on CRLF file -python -c 'file("a", "wb").write("a\r\nbbb\r\ncc\r\n\r\nd\r\ne")' -hg commit -m 'switch EOLs in a' -hg --traceback --config patch.eol='auto' import eol.diff -python -c 'print repr(file("a","rb").read())' -hg st - -echo % auto EOL on new file or source without any EOL -python -c 'file("noeol", "wb").write("noeol")' -hg add noeol -hg commit -m 'add noeol' -python -c 'file("noeol", "wb").write("noeol\r\nnoeol\n")' -python -c 'file("neweol", "wb").write("neweol\nneweol\r\n")' -hg add neweol -hg diff --git > noeol.diff -hg revert --no-backup noeol neweol -rm neweol -hg --traceback --config patch.eol='auto' import -m noeol noeol.diff -python -c 'print repr(file("noeol","rb").read())' -python -c 'print repr(file("neweol","rb").read())' -hg st - -# Test --eol and binary patches -python -c 'file("b", "wb").write("a\x00\nb\r\nd")' -hg ci -Am addb -python -c 'file("b", "wb").write("a\x00\nc\r\nd")' -hg diff --git > bin.diff -hg revert --no-backup b -echo % binary patch with --eol -hg import --config patch.eol='CRLF' -m changeb bin.diff -python -c 'print repr(file("b","rb").read())' -hg st -cd ..
--- a/tests/test-import-eol.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -adding .hgignore -adding a -% invalid eol -applying eol.diff -abort: Unsupported line endings type: LFCR -% force LF -applying eol.diff -'a\nyyyy\ncc\n\nd\ne' -% force CRLF -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying eol.diff -'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne' -% auto EOL on LF file -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying eol.diff -'a\nyyyy\ncc\n\nd\ne' -% auto EOL on CRLF file -applying eol.diff -'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne' -% auto EOL on new file or source without any EOL -applying noeol.diff -'noeol\r\nnoeol\n' -'neweol\nneweol\r\n' -adding b -% binary patch with --eol -applying bin.diff -'a\x00\nc\r\nd'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-import-eol.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,121 @@ + $ cat > makepatch.py <<EOF + > f = file('eol.diff', 'wb') + > w = f.write + > w('test message\n') + > w('diff --git a/a b/a\n') + > w('--- a/a\n') + > w('+++ b/a\n') + > w('@@ -1,5 +1,5 @@\n') + > w(' a\n') + > w('-bbb\r\n') + > w('+yyyy\r\n') + > w(' cc\r\n') + > w(' \n') + > w(' d\n') + > w('-e\n') + > w('\ No newline at end of file\n') + > w('+z\r\n') + > w('\ No newline at end of file\r\n') + > EOF + + $ hg init repo + $ cd repo + $ echo '\.diff' > .hgignore + + +Test different --eol values + + $ python -c 'file("a", "wb").write("a\nbbb\ncc\n\nd\ne")' + $ hg ci -Am adda + adding .hgignore + adding a + $ python ../makepatch.py + + +invalid eol + + $ hg --config patch.eol='LFCR' import eol.diff + applying eol.diff + abort: Unsupported line endings type: LFCR + $ hg revert -a + + +force LF + + $ hg --traceback --config patch.eol='LF' import eol.diff + applying eol.diff + $ python -c 'print repr(file("a","rb").read())' + 'a\nyyyy\ncc\n\nd\ne' + $ hg st + + +force CRLF + + $ hg up -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --traceback --config patch.eol='CRLF' import eol.diff + applying eol.diff + $ python -c 'print repr(file("a","rb").read())' + 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne' + $ hg st + + +auto EOL on LF file + + $ hg up -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --traceback --config patch.eol='auto' import eol.diff + applying eol.diff + $ python -c 'print repr(file("a","rb").read())' + 'a\nyyyy\ncc\n\nd\ne' + $ hg st + + +auto EOL on CRLF file + + $ python -c 'file("a", "wb").write("a\r\nbbb\r\ncc\r\n\r\nd\r\ne")' + $ hg commit -m 'switch EOLs in a' + $ hg --traceback --config patch.eol='auto' import eol.diff + applying eol.diff + $ python -c 'print repr(file("a","rb").read())' + 'a\r\nyyyy\r\ncc\r\n\r\nd\r\ne' + $ hg st + + +auto EOL on new file or source without any EOL + + $ python -c 'file("noeol", "wb").write("noeol")' + $ hg add noeol + $ hg commit -m 'add noeol' + $ python -c 'file("noeol", "wb").write("noeol\r\nnoeol\n")' + $ python -c 'file("neweol", "wb").write("neweol\nneweol\r\n")' + $ hg add neweol + $ hg diff --git > noeol.diff + $ hg revert --no-backup noeol neweol + $ rm neweol + $ hg --traceback --config patch.eol='auto' import -m noeol noeol.diff + applying noeol.diff + $ python -c 'print repr(file("noeol","rb").read())' + 'noeol\r\nnoeol\n' + $ python -c 'print repr(file("neweol","rb").read())' + 'neweol\nneweol\r\n' + $ hg st + + +Test --eol and binary patches + + $ python -c 'file("b", "wb").write("a\x00\nb\r\nd")' + $ hg ci -Am addb + adding b + $ python -c 'file("b", "wb").write("a\x00\nc\r\nd")' + $ hg diff --git > bin.diff + $ hg revert --no-backup b + +binary patch with --eol + + $ hg import --config patch.eol='CRLF' -m changeb bin.diff + applying bin.diff + $ python -c 'print repr(file("b","rb").read())' + 'a\x00\nc\r\nd' + $ hg st + $ cd ..
--- a/tests/test-import.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -adding a -adding d1/d2/a -% import exported patch -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -% message should be same -summary: second change -% committer should be same -user: someone -% import exported patch with external patcher -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -line2 -% import of plain diff should fail without message -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -abort: empty commit message -% import of plain diff should be ok with message -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -% import of plain diff with specific date and user -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -changeset: 1:ca68f19f3a40 -tag: tip -user: user@nowhere.net -date: Thu Jan 01 00:00:01 1970 +0000 -files: a -description: -patch - - -diff -r 80971e65b431 -r ca68f19f3a40 a ---- a/a Thu Jan 01 00:00:00 1970 +0000 -+++ b/a Thu Jan 01 00:00:01 1970 +0000 -@@ -1,1 +1,2 @@ - line 1 -+line 2 - -% import of plain diff should be ok with --no-commit -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../tip.patch -diff -r 80971e65b431 a ---- a/a -+++ b/a -@@ -1,1 +1,2 @@ - line 1 -+line 2 -% hg -R repo import -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying tip.patch -% import from stdin -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -% import two patches in one stream -applying patch from stdin -applied 80971e65b431 -1d4bd90af0e4 tip -1d4bd90af0e4 tip -% override commit message -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -summary: override -% plain diff in email, subject, message body -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../msg.patch -user: email patcher -summary: email patch -% plain diff in email, no subject, message body -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -% plain diff in email, subject, no message body -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -% plain diff in email, no subject, no message body, should fail -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -abort: empty commit message -% hg export in email, should use patch header -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -summary: second change -% plain diff in email, [PATCH] subject, message body with subject -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin -email patch - -next line ---- -% import patch1 patch2; rollback -parent: 0 -applying ../patch1 -applying ../patch2 -applied 1d4bd90af0e4 -rolling back to revision 1 (undo commit) -parent: 1 -% hg import in a subdirectory -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../../../tip.patch -% message should be 'subdir change' -summary: subdir change -% committer should be 'someoneelse' -user: someoneelse -% should be empty -% test fuzziness -adding a -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -applying tip.patch -patching file a -Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). -reverting a -% test fuzziness with eol=auto -applying tip.patch -patching file a -Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). -adding a -adding b1 -adding c1 -adding d -diff --git a/a b/a ---- a/a -+++ b/a -@@ -0,0 +1,1 @@ -+a -diff --git a/b1 b/b2 -rename from b1 -rename to b2 ---- a/b1 -+++ b/b2 -@@ -0,0 +1,1 @@ -+b -diff --git a/c1 b/c1 ---- a/c1 -+++ b/c1 -@@ -0,0 +1,1 @@ -+c -diff --git a/c1 b/c2 -copy from c1 -copy to c2 ---- a/c1 -+++ b/c2 -@@ -0,0 +1,1 @@ -+c -diff --git a/d b/d ---- a/d -+++ b/d -@@ -1,1 +0,0 @@ --d -4 files updated, 0 files merged, 2 files removed, 0 files unresolved -applying empty.diff -% a file -a -% b1 file -% b2 file -b -% c1 file -c -% c2 file -c -% d file -% test trailing binary removal -adding a -adding b -R a -R b -diff --git a/a b/a -diff --git a/b b/b -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying remove.diff -% test update+rename with common name (issue 927) -adding a -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -applying copy.diff -% view a -a -% view a2 -a -% test -p0 -adding a -applying patch from stdin -bb -% test paths outside repo root -applying patch from stdin -abort: ../outside/foo not under root -% test import with similarity and git and strip (issue295 et al.) -adding a -applying ../rename.diff -patching file a -patching file b -removing a -adding b -recording removal of a as rename to b (88% similar) -A b - a -R a -undeleting a -forgetting b -applying ../rename.diff -patching file a -patching file b -removing a -adding b -A b -R a -% add empty file from the end of patch (issue 1495) -adding a -applying a.patch -% create file when source is not /dev/null -applying ../create.patch -a -applying ../create2.patch -a -% first line mistaken for email headers (issue 1859) -applying a.patch -changeset: 0:5a681217c0ad -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -files: a -description: -module: summary - -description - - -% --- in commit message -applying a.patch -changeset: 0:f34d9187897d -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -files: a -description: -module: summary - - -% tricky header splitting -applying ../trickyheaders.patch -# HG changeset patch -# User User B -# Date 0 0 -# Node ID eb56ab91903632294ac504838508cb370c0901d2 -# Parent 0000000000000000000000000000000000000000 -from: tricky! - -That is not a header. - -diff --git a/foo b/foo -new file mode 100644 ---- /dev/null -+++ b/foo -@@ -0,0 +1,1 @@ -+foo -% issue2102 -adding src/cmd/gc/mksys.bash -applying patch from stdin -parent: 1:d59915696727 tip - help management of empty pkg and lib directories in perforce -branch: default -commit: (clean) -update: (current) -diff --git a/lib/place-holder b/lib/place-holder -new file mode 100644 ---- /dev/null -+++ b/lib/place-holder -@@ -0,0 +1,2 @@ -+perforce does not maintain empty directories. -+this file helps. -diff --git a/pkg/place-holder b/pkg/place-holder -new file mode 100644 ---- /dev/null -+++ b/pkg/place-holder -@@ -0,0 +1,2 @@ -+perforce does not maintain empty directories. -+this file helps. -diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash -old mode 100644 -new mode 100755 -% diff lines looking like headers -adding a -adding b -adding c -3 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying patch from stdin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-import.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,916 @@ + $ hg init a + $ mkdir a/d1 + $ mkdir a/d1/d2 + $ echo line 1 > a/a + $ echo line 1 > a/d1/d2/a + $ hg --cwd a ci -Ama + adding a + adding d1/d2/a + + $ echo line 2 >> a/a + $ hg --cwd a ci -u someone -d '1 0' -m'second change' + + +import exported patch + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip > tip.patch + $ hg --cwd b import ../tip.patch + applying ../tip.patch + +message should be same + + $ hg --cwd b tip | grep 'second change' + summary: second change + +committer should be same + + $ hg --cwd b tip | grep someone + user: someone + $ rm -r b + + +import exported patch with external patcher + + $ cat > dummypatch.py <<EOF + > print 'patching file a' + > file('a', 'wb').write('line2\n') + > EOF + $ chmod +x dummypatch.py + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip > tip.patch + $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch + applying ../tip.patch + $ cat b/a + line2 + $ rm -r b + + +import of plain diff should fail without message + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ hg --cwd b import ../tip.patch + applying ../tip.patch + abort: empty commit message + $ rm -r b + + +import of plain diff should be ok with message + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ hg --cwd b import -mpatch ../tip.patch + applying ../tip.patch + $ rm -r b + + +import of plain diff with specific date and user + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch + applying ../tip.patch + $ hg -R b tip -pv + changeset: 1:ca68f19f3a40 + tag: tip + user: user@nowhere.net + date: Thu Jan 01 00:00:01 1970 +0000 + files: a + description: + patch + + + diff -r 80971e65b431 -r ca68f19f3a40 a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:01 1970 +0000 + @@ -1,1 +1,2 @@ + line 1 + +line 2 + + $ rm -r b + + +import of plain diff should be ok with --no-commit + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ hg --cwd b import --no-commit ../tip.patch + applying ../tip.patch + $ hg --cwd b diff --nodates + diff -r 80971e65b431 a + --- a/a + +++ b/a + @@ -1,1 +1,2 @@ + line 1 + +line 2 + $ rm -r b + + +hg -R repo import +put the clone in a subdir - having a directory named "a" +used to hide a bug. + + $ mkdir dir + $ hg clone -r0 a dir/b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip > dir/tip.patch + $ cd dir + $ hg -R b import tip.patch + applying tip.patch + $ cd .. + $ rm -r dir + + +import from stdin + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip | hg --cwd b import - + applying patch from stdin + $ rm -r b + + +import two patches in one stream + + $ hg init b + $ hg --cwd a export 0:tip | hg --cwd b import - + applying patch from stdin + applied 80971e65b431 + $ hg --cwd a id + 1d4bd90af0e4 tip + $ hg --cwd b id + 1d4bd90af0e4 tip + $ rm -r b + + +override commit message + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip | hg --cwd b import -m 'override' - + applying patch from stdin + $ hg --cwd b tip | grep override + summary: override + $ rm -r b + + $ cat > mkmsg.py <<EOF + > import email.Message, sys + > msg = email.Message.Message() + > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) + > msg['Subject'] = 'email patch' + > msg['From'] = 'email patcher' + > sys.stdout.write(msg.as_string()) + > EOF + + +plain diff in email, subject, message body + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ python mkmsg.py > msg.patch + $ hg --cwd b import ../msg.patch + applying ../msg.patch + $ hg --cwd b tip | grep email + user: email patcher + summary: email patch + $ rm -r b + + +plain diff in email, no subject, message body + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ grep -v '^Subject:' msg.patch | hg --cwd b import - + applying patch from stdin + $ rm -r b + + +plain diff in email, subject, no message body + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ grep -v '^email ' msg.patch | hg --cwd b import - + applying patch from stdin + $ rm -r b + + +plain diff in email, no subject, no message body, should fail + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - + applying patch from stdin + abort: empty commit message + $ rm -r b + + +hg export in email, should use patch header + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip > tip.patch + $ python mkmsg.py | hg --cwd b import - + applying patch from stdin + $ hg --cwd b tip | grep second + summary: second change + $ rm -r b + + +subject: duplicate detection, removal of [PATCH] +The '---' tests the gitsendmail handling without proper mail headers + + $ cat > mkmsg2.py <<EOF + > import email.Message, sys + > msg = email.Message.Message() + > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) + > msg['Subject'] = '[PATCH] email patch' + > msg['From'] = 'email patcher' + > sys.stdout.write(msg.as_string()) + > EOF + + +plain diff in email, [PATCH] subject, message body with subject + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a diff -r0:1 > tip.patch + $ python mkmsg2.py | hg --cwd b import - + applying patch from stdin + $ hg --cwd b tip --template '{desc}\n' + email patch + + next line + --- + $ rm -r b + + +We weren't backing up the correct dirstate file when importing many patches +(issue963) +import patch1 patch2; rollback + + $ echo line 3 >> a/a + $ hg --cwd a ci -m'third change' + $ hg --cwd a export -o '../patch%R' 1 2 + $ hg clone -qr0 a b + $ hg --cwd b parents --template 'parent: {rev}\n' + parent: 0 + $ hg --cwd b import ../patch1 ../patch2 + applying ../patch1 + applying ../patch2 + applied 1d4bd90af0e4 + $ hg --cwd b rollback + rolling back to revision 1 (undo commit) + $ hg --cwd b parents --template 'parent: {rev}\n' + parent: 1 + $ rm -r b + + +importing a patch in a subdirectory failed at the commit stage + + $ echo line 2 >> a/d1/d2/a + $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' + +hg import in a subdirectory + + $ hg clone -r0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch + $ dir=`pwd` + $ cd b/d1/d2 2>&1 > /dev/null + $ hg import ../../../tip.patch + applying ../../../tip.patch + $ cd "$dir" + +message should be 'subdir change' + + $ hg --cwd b tip | grep 'subdir change' + summary: subdir change + +committer should be 'someoneelse' + + $ hg --cwd b tip | grep someoneelse + user: someoneelse + +should be empty + + $ hg --cwd b status + + +Test fuzziness (ambiguous patch location, fuzz=2) + + $ hg init fuzzy + $ cd fuzzy + $ echo line1 > a + $ echo line0 >> a + $ echo line3 >> a + $ hg ci -Am adda + adding a + $ echo line1 > a + $ echo line2 >> a + $ echo line0 >> a + $ echo line3 >> a + $ hg ci -m change a + $ hg export tip > tip.patch + $ hg up -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo line1 > a + $ echo line0 >> a + $ echo line1 >> a + $ echo line0 >> a + $ hg ci -m brancha + created new head + $ hg import --no-commit -v tip.patch + applying tip.patch + patching file a + Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). + $ hg revert -a + reverting a + +test fuzziness with eol=auto + + $ hg --config patch.eol=auto import --no-commit -v tip.patch + applying tip.patch + patching file a + Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). + $ cd .. + + +Test hunk touching empty files (issue906) + + $ hg init empty + $ cd empty + $ touch a + $ touch b1 + $ touch c1 + $ echo d > d + $ hg ci -Am init + adding a + adding b1 + adding c1 + adding d + $ echo a > a + $ echo b > b1 + $ hg mv b1 b2 + $ echo c > c1 + $ hg copy c1 c2 + $ rm d + $ touch d + $ hg diff --git + diff --git a/a b/a + --- a/a + +++ b/a + @@ -0,0 +1,1 @@ + +a + diff --git a/b1 b/b2 + rename from b1 + rename to b2 + --- a/b1 + +++ b/b2 + @@ -0,0 +1,1 @@ + +b + diff --git a/c1 b/c1 + --- a/c1 + +++ b/c1 + @@ -0,0 +1,1 @@ + +c + diff --git a/c1 b/c2 + copy from c1 + copy to c2 + --- a/c1 + +++ b/c2 + @@ -0,0 +1,1 @@ + +c + diff --git a/d b/d + --- a/d + +++ b/d + @@ -1,1 +0,0 @@ + -d + $ hg ci -m empty + $ hg export --git tip > empty.diff + $ hg up -C 0 + 4 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg import empty.diff + applying empty.diff + $ for name in a b1 b2 c1 c2 d; do + > echo % $name file + > test -f $name && cat $name + > done + % a file + a + % b1 file + % b2 file + b + % c1 file + c + % c2 file + c + % d file + $ cd .. + + +Test importing a patch ending with a binary file removal + + $ hg init binaryremoval + $ cd binaryremoval + $ echo a > a + $ python -c "file('b', 'wb').write('a\x00b')" + $ hg ci -Am addall + adding a + adding b + $ hg rm a + $ hg rm b + $ hg st + R a + R b + $ hg ci -m remove + $ hg export --git . > remove.diff + $ cat remove.diff | grep git + diff --git a/a b/a + diff --git a/b b/b + $ hg up -C 0 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg import remove.diff + applying remove.diff + $ hg manifest + $ cd .. + + +test update+rename with common name (issue 927) + + $ hg init t + $ cd t + $ touch a + $ hg ci -Am t + adding a + $ echo a > a + +Here, bfile.startswith(afile) + + $ hg copy a a2 + $ hg ci -m copya + $ hg export --git tip > copy.diff + $ hg up -C 0 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg import copy.diff + applying copy.diff + +a should contain an 'a' + + $ cat a + a + +and a2 should have duplicated it + + $ cat a2 + a + $ cd .. + + +test -p0 + + $ hg init p0 + $ cd p0 + $ echo a > a + $ hg ci -Am t + adding a + $ hg import -p0 - << EOF + > foobar + > --- a Sat Apr 12 22:43:58 2008 -0400 + > +++ a Sat Apr 12 22:44:05 2008 -0400 + > @@ -1,1 +1,1 @@ + > -a + > +bb + > EOF + applying patch from stdin + $ hg status + $ cat a + bb + $ cd .. + + +test paths outside repo root + + $ mkdir outside + $ touch outside/foo + $ hg init inside + $ cd inside + $ hg import - <<EOF + > diff --git a/a b/b + > rename from ../outside/foo + > rename to bar + > EOF + applying patch from stdin + abort: ../outside/foo not under root + $ cd .. + + +test import with similarity and git and strip (issue295 et al.) + + $ hg init sim + $ cd sim + $ echo 'this is a test' > a + $ hg ci -Ama + adding a + $ cat > ../rename.diff <<EOF + > diff --git a/foo/a b/foo/a + > deleted file mode 100644 + > --- a/foo/a + > +++ /dev/null + > @@ -1,1 +0,0 @@ + > -this is a test + > diff --git a/foo/b b/foo/b + > new file mode 100644 + > --- /dev/null + > +++ b/foo/b + > @@ -0,0 +1,2 @@ + > +this is a test + > +foo + > EOF + $ hg import --no-commit -v -s 1 ../rename.diff -p2 + applying ../rename.diff + patching file a + patching file b + removing a + adding b + recording removal of a as rename to b (88% similar) + $ hg st -C + A b + a + R a + $ hg revert -a + undeleting a + forgetting b + $ rm b + $ hg import --no-commit -v -s 100 ../rename.diff -p2 + applying ../rename.diff + patching file a + patching file b + removing a + adding b + $ hg st -C + A b + R a + $ cd .. + + +add empty file from the end of patch (issue 1495) + + $ hg init addemptyend + $ cd addemptyend + $ touch a + $ hg addremove + adding a + $ hg ci -m "commit" + $ cat > a.patch <<EOF + > diff --git a/a b/a + > --- a/a + > +++ b/a + > @@ -0,0 +1,1 @@ + > +a + > diff --git a/b b/b + > new file mode 100644 + > EOF + $ hg import --no-commit a.patch + applying a.patch + $ cd .. + + +create file when source is not /dev/null + + $ cat > create.patch <<EOF + > diff -Naur proj-orig/foo proj-new/foo + > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 + > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 + > @@ -0,0 +1,1 @@ + > +a + > EOF + +some people have patches like the following too + + $ cat > create2.patch <<EOF + > diff -Naur proj-orig/foo proj-new/foo + > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 + > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 + > @@ -0,0 +1,1 @@ + > +a + > EOF + $ hg init oddcreate + $ cd oddcreate + $ hg import --no-commit ../create.patch + applying ../create.patch + $ cat foo + a + $ rm foo + $ hg revert foo + $ hg import --no-commit ../create2.patch + applying ../create2.patch + $ cat foo + a + + +first line mistaken for email headers (issue 1859) + + $ hg init emailconfusion + $ cd emailconfusion + $ cat > a.patch <<EOF + > module: summary + > + > description + > + > + > diff -r 000000000000 -r 9b4c1e343b55 test.txt + > --- /dev/null + > +++ b/a + > @@ -0,0 +1,1 @@ + > +a + > EOF + $ hg import -d '0 0' a.patch + applying a.patch + $ hg parents -v + changeset: 0:5a681217c0ad + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + files: a + description: + module: summary + + description + + + $ cd .. + + +--- in commit message + + $ hg init commitconfusion + $ cd commitconfusion + $ cat > a.patch <<EOF + > module: summary + > + > --- description + > + > diff --git a/a b/a + > new file mode 100644 + > --- /dev/null + > +++ b/a + > @@ -0,0 +1,1 @@ + > +a + > EOF + > hg import -d '0 0' a.patch + > hg parents -v + > cd .. + > + > echo '% tricky header splitting' + > cat > trickyheaders.patch <<EOF + > From: User A <user@a> + > Subject: [PATCH] from: tricky! + > + > # HG changeset patch + > # User User B + > # Date 1266264441 18000 + > # Branch stable + > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 + > # Parent 0000000000000000000000000000000000000000 + > from: tricky! + > + > That is not a header. + > + > diff -r 000000000000 -r f2be6a1170ac foo + > --- /dev/null + > +++ b/foo + > @@ -0,0 +1,1 @@ + > +foo + > EOF + applying a.patch + changeset: 0:f34d9187897d + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + files: a + description: + module: summary + + + % tricky header splitting + + $ hg init trickyheaders + $ cd trickyheaders + $ hg import -d '0 0' ../trickyheaders.patch + applying ../trickyheaders.patch + $ hg export --git tip + # HG changeset patch + # User User B + # Date 0 0 + # Node ID eb56ab91903632294ac504838508cb370c0901d2 + # Parent 0000000000000000000000000000000000000000 + from: tricky! + + That is not a header. + + diff --git a/foo b/foo + new file mode 100644 + --- /dev/null + +++ b/foo + @@ -0,0 +1,1 @@ + +foo + $ cd .. + + +issue2102 + + $ hg init issue2102 + $ cd issue2102 + $ mkdir -p src/cmd/gc + $ touch src/cmd/gc/mksys.bash + $ hg ci -Am init + adding src/cmd/gc/mksys.bash + $ hg import - <<EOF + > # HG changeset patch + > # User Rob Pike + > # Date 1216685449 25200 + > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 + > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 + > help management of empty pkg and lib directories in perforce + > + > R=gri + > DELTA=4 (4 added, 0 deleted, 0 changed) + > OCL=13328 + > CL=13328 + > + > diff --git a/lib/place-holder b/lib/place-holder + > new file mode 100644 + > --- /dev/null + > +++ b/lib/place-holder + > @@ -0,0 +1,2 @@ + > +perforce does not maintain empty directories. + > +this file helps. + > diff --git a/pkg/place-holder b/pkg/place-holder + > new file mode 100644 + > --- /dev/null + > +++ b/pkg/place-holder + > @@ -0,0 +1,2 @@ + > +perforce does not maintain empty directories. + > +this file helps. + > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash + > old mode 100644 + > new mode 100755 + > EOF + applying patch from stdin + $ hg sum + parent: 1:d59915696727 tip + help management of empty pkg and lib directories in perforce + branch: default + commit: (clean) + update: (current) + $ hg diff --git -c tip + diff --git a/lib/place-holder b/lib/place-holder + new file mode 100644 + --- /dev/null + +++ b/lib/place-holder + @@ -0,0 +1,2 @@ + +perforce does not maintain empty directories. + +this file helps. + diff --git a/pkg/place-holder b/pkg/place-holder + new file mode 100644 + --- /dev/null + +++ b/pkg/place-holder + @@ -0,0 +1,2 @@ + +perforce does not maintain empty directories. + +this file helps. + diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash + old mode 100644 + new mode 100755 + $ cd .. + + +diff lines looking like headers + + $ hg init difflineslikeheaders + $ cd difflineslikeheaders + $ echo a >a + $ echo b >b + $ echo c >c + $ hg ci -Am1 + adding a + adding b + adding c + + $ echo "key: value" >>a + $ echo "key: value" >>b + $ echo "foo" >>c + $ hg ci -m2 + + $ hg up -C 0 + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg diff --git -c1 >want + $ hg diff -c1 | hg import --no-commit - + applying patch from stdin + $ hg diff --git >have + $ diff want have + $ cd .. +
--- a/tests/test-init Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -#!/bin/sh - -# This test tries to exercise the ssh functionality with a dummy script - -cat <<EOF > dummyssh -import sys -import os - -os.chdir(os.path.dirname(sys.argv[0])) -if sys.argv[1] != "user@dummy": - sys.exit(-1) - -if not os.path.exists("dummyssh"): - sys.exit(-1) - -log = open("dummylog", "ab") -log.write("Got arguments") -for i, arg in enumerate(sys.argv[1:]): - log.write(" %d:%s" % (i+1, arg)) -log.write("\n") -log.close() -r = os.system(sys.argv[2]) -sys.exit(bool(r)) -EOF - -checknewrepo() -{ - name=$1 - - if [ -d $name/.hg/store ]; then - echo store created - fi - - if [ -f $name/.hg/00changelog.i ]; then - echo 00changelog.i created - fi - - cat $name/.hg/requires -} - -echo "# creating 'local'" -hg init local -checknewrepo local -echo this > local/foo -hg ci --cwd local -A -m "init" -d "1000000 0" - -echo "# creating repo with format.usestore=false" -hg --config format.usestore=false init old -checknewrepo old - -echo "# creating repo with format.usefncache=false" -hg --config format.usefncache=false init old2 -checknewrepo old2 - -echo "#test failure" -hg init local - -echo "# init+push to remote2" -hg init -e "python ./dummyssh" ssh://user@dummy/remote2 -hg incoming -R remote2 local -hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2 - -echo "# clone to remote1" -hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 - -echo "# init to existing repo" -hg init -e "python ./dummyssh" ssh://user@dummy/remote1 - -echo "# clone to existing repo" -hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 - -echo "# output of dummyssh" -cat dummylog - -echo "# comparing repositories" -hg tip -q -R local -hg tip -q -R remote1 -hg tip -q -R remote2 - -echo "# check names for repositories (clashes with URL schemes, special chars)" -for i in bundle file hg http https old-http ssh static-http " " "with space"; do - echo "# hg init \"$i\"" - hg init "$i" - test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" -done - -echo "# creating 'local/sub/repo'" -hg init local/sub/repo -checknewrepo local/sub/repo
--- a/tests/test-init.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -# creating 'local' -store created -00changelog.i created -revlogv1 -store -fncache -adding foo -# creating repo with format.usestore=false -revlogv1 -# creating repo with format.usefncache=false -store created -00changelog.i created -revlogv1 -store -#test failure -abort: repository local already exists! -# init+push to remote2 -comparing with local -changeset: 0:c4e059d443be -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: init - -pushing to ssh://user@dummy/remote2 -searching for changes -remote: adding changesets -remote: adding manifests -remote: adding file changes -remote: added 1 changesets with 1 changes to 1 files -# clone to remote1 -searching for changes -remote: adding changesets -remote: adding manifests -remote: adding file changes -remote: added 1 changesets with 1 changes to 1 files -# init to existing repo -abort: repository remote1 already exists! -abort: could not create remote repo! -# clone to existing repo -abort: repository remote1 already exists! -abort: could not create remote repo! -# output of dummyssh -Got arguments 1:user@dummy 2:hg init remote2 -Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio -Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio -Got arguments 1:user@dummy 2:hg init remote1 -Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio -Got arguments 1:user@dummy 2:hg init remote1 -Got arguments 1:user@dummy 2:hg init remote1 -# comparing repositories -0:c4e059d443be -0:c4e059d443be -0:c4e059d443be -# check names for repositories (clashes with URL schemes, special chars) -# hg init "bundle" -ok -# hg init "file" -ok -# hg init "hg" -ok -# hg init "http" -ok -# hg init "https" -ok -# hg init "old-http" -ok -# hg init "ssh" -ok -# hg init "static-http" -ok -# hg init " " -ok -# hg init "with space" -ok -# creating 'local/sub/repo' -store created -00changelog.i created -revlogv1 -store -fncache
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-init.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,156 @@ +# This test tries to exercise the ssh functionality with a dummy script + + $ cat <<EOF > dummyssh + > import sys + > import os + > + > os.chdir(os.path.dirname(sys.argv[0])) + > if sys.argv[1] != "user@dummy": + > sys.exit(-1) + > + > if not os.path.exists("dummyssh"): + > sys.exit(-1) + > + > log = open("dummylog", "ab") + > log.write("Got arguments") + > for i, arg in enumerate(sys.argv[1:]): + > log.write(" %d:%s" % (i+1, arg)) + > log.write("\n") + > log.close() + > r = os.system(sys.argv[2]) + > sys.exit(bool(r)) + > EOF + + $ checknewrepo() + > { + > name=$1 + > if [ -d $name/.hg/store ]; then + > echo store created + > fi + > if [ -f $name/.hg/00changelog.i ]; then + > echo 00changelog.i created + > fi + > cat $name/.hg/requires + > } + +creating 'local' + + $ hg init local + $ checknewrepo local + store created + 00changelog.i created + revlogv1 + store + fncache + $ echo this > local/foo + $ hg ci --cwd local -A -m "init" -d "1000000 0" + adding foo + +creating repo with format.usestore=false + + $ hg --config format.usestore=false init old + $ checknewrepo old + revlogv1 + +creating repo with format.usefncache=false + + $ hg --config format.usefncache=false init old2 + $ checknewrepo old2 + store created + 00changelog.i created + revlogv1 + store + +test failure + + $ hg init local + abort: repository local already exists! + +init+push to remote2 + + $ hg init -e "python ./dummyssh" ssh://user@dummy/remote2 + $ hg incoming -R remote2 local + comparing with local + changeset: 0:c4e059d443be + tag: tip + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: init + + + $ hg push -R local -e "python ./dummyssh" ssh://user@dummy/remote2 + pushing to ssh://user@dummy/remote2 + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + +clone to remote1 + + $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files + +init to existing repo + + $ hg init -e "python ./dummyssh" ssh://user@dummy/remote1 + abort: repository remote1 already exists! + abort: could not create remote repo! + +clone to existing repo + + $ hg clone -e "python ./dummyssh" local ssh://user@dummy/remote1 + abort: repository remote1 already exists! + abort: could not create remote repo! + +output of dummyssh + + $ cat dummylog + Got arguments 1:user@dummy 2:hg init remote2 + Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio + Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio + Got arguments 1:user@dummy 2:hg init remote1 + Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio + Got arguments 1:user@dummy 2:hg init remote1 + Got arguments 1:user@dummy 2:hg init remote1 + +comparing repositories + + $ hg tip -q -R local + 0:c4e059d443be + $ hg tip -q -R remote1 + 0:c4e059d443be + $ hg tip -q -R remote2 + 0:c4e059d443be + +check names for repositories (clashes with URL schemes, special chars) + + $ for i in bundle file hg http https old-http ssh static-http " " "with space"; do + > echo -n "hg init \"$i\"... " + > hg init "$i" + > test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed" + > done + hg init "bundle"... ok + hg init "file"... ok + hg init "hg"... ok + hg init "http"... ok + hg init "https"... ok + hg init "old-http"... ok + hg init "ssh"... ok + hg init "static-http"... ok + hg init " "... ok + hg init "with space"... ok + +creating 'local/sub/repo' + + $ hg init local/sub/repo + $ checknewrepo local/sub/repo + store created + 00changelog.i created + revlogv1 + store + fncache
--- a/tests/test-mq-guards Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-mq-guards Thu Aug 12 18:08:52 2010 -0500 @@ -97,11 +97,16 @@ hg qguard -- a.patch +1 +2 -3 hg qselect 1 2 3 + echo % list patches and guards hg qguard -l +echo % have at least one patch applied to test coloring +hg qpush echo % list patches and guards with color hg --config extensions.color= qguard --config color.mode=ansi \ -l --color=always +echo % should pop b.patch +hg qpop echo % list series hg qseries -v echo % list guards
--- a/tests/test-mq-guards.out Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-mq-guards.out Thu Aug 12 18:08:52 2010 -0500 @@ -84,10 +84,16 @@ a.patch: +1 +2 -3 b.patch: +2 c.patch: unguarded +% have at least one patch applied to test coloring +applying b.patch +now at: b.patch % list patches and guards with color -a.patch: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m -b.patch: [0;33m+2[0m -c.patch: [0;32munguarded[0m +[0;30;1ma.patch[0m: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m +[0;34;1;4mb.patch[0m: [0;33m+2[0m +[0;30;1mc.patch[0m: [0;32munguarded[0m +% should pop b.patch +popping b.patch +patch queue now empty % list series 0 G a.patch 1 U b.patch
--- a/tests/test-mq-strip Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-mq-strip Thu Aug 12 18:08:52 2010 -0500 @@ -4,16 +4,20 @@ echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH +echo "graphlog=" >> $HGRCPATH +restore() { + hg unbundle -q .hg/strip-backup/* + rm .hg/strip-backup/* +} teststrip() { hg up -C $1 echo % before update $1, strip $2 hg parents - hg strip $2 | hidebackup + hg --traceback strip $2 | hidebackup echo % after update $1, strip $2 hg parents - hg unbundle -q .hg/strip-backup/* - rm .hg/strip-backup/* + restore } hg init test @@ -53,6 +57,25 @@ hg strip 4 2>&1 | hidebackup echo % after strip of merge parent hg parents +restore + +hg up +hg glog +echo % 2 is parent of 3, only one strip should happen +hg strip 2 3 | hidebackup +hg glog +restore +hg glog +echo % 2 different branches: 2 strips +hg strip 2 4 | hidebackup +hg glog +restore +echo % 2 different branches and a common ancestor: 1 strip +hg strip 1 2 4 | hidebackup +restore + +# remove branchy history for qimport tests +hg strip 3 | hidebackup #strip of applied mq should cleanup status file hg up -C 3
--- a/tests/test-mq-strip.out Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-mq-strip.out Thu Aug 12 18:08:52 2010 -0500 @@ -166,6 +166,103 @@ summary: b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ changeset: 4:264128213d29 +| tag: tip +| parent: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: c +| +| o changeset: 3:443431ffac4f +| | user: test +| | date: Thu Jan 01 00:00:00 1970 +0000 +| | summary: e +| | +| o changeset: 2:65bd5f99a4a3 +|/ user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: d +| +o changeset: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: b +| +o changeset: 0:9ab35a2d17cb + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + +% 2 is parent of 3, only one strip should happen +saved backup bundle to +@ changeset: 2:264128213d29 +| tag: tip +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: c +| +o changeset: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: b +| +o changeset: 0:9ab35a2d17cb + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + +o changeset: 4:443431ffac4f +| tag: tip +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: e +| +o changeset: 3:65bd5f99a4a3 +| parent: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: d +| +| @ changeset: 2:264128213d29 +|/ user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: c +| +o changeset: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: b +| +o changeset: 0:9ab35a2d17cb + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + +% 2 different branches: 2 strips +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +saved backup bundle to +@ changeset: 2:65bd5f99a4a3 +| tag: tip +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: d +| +o changeset: 1:ef3a871183d7 +| user: test +| date: Thu Jan 01 00:00:00 1970 +0000 +| summary: b +| +o changeset: 0:9ab35a2d17cb + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + +% 2 different branches and a common ancestor: 1 strip +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +saved backup bundle to +saved backup bundle to +1 files updated, 0 files merged, 0 files removed, 0 files unresolved % applied patches before strip 2.diff 3.diff
--- a/tests/test-mq.out Thu Aug 12 18:10:42 2010 +0200 +++ b/tests/test-mq.out Thu Aug 12 18:08:52 2010 -0500 @@ -59,7 +59,7 @@ qseries print the entire series file qtop print the name of the current patch qunapplied print the patches not yet applied - strip strip a changeset and all its descendants from the repository + strip strip changesets and all their descendants from the repository use "hg -v help mq" to show aliases and global options adding a
--- a/tests/test-parents Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -#!/bin/sh -# test parents command - -hg init repo -cd repo -echo % no working directory -hg parents - -echo a > a -echo b > b -hg ci -Amab -d '0 0' -echo a >> a -hg ci -Ama -d '1 0' -echo b >> b -hg ci -Amb -d '2 0' -echo c > c -hg ci -Amc -d '3 0' -hg up -C 1 -echo d > c -hg ci -Amc2 -d '4 0' -hg up -C 3 - -echo % hg parents -hg parents - -echo % hg parents a -hg parents a - -echo % hg parents c, single revision -hg parents c - -echo % hg parents -r 3 c -hg parents -r 3 c - -echo % hg parents -r 2 -hg parents -r 2 - -echo % hg parents -r 2 a -hg parents -r 2 a - -echo % hg parents -r 2 ../a -hg parents -r 2 ../a - -echo '% cd dir; hg parents -r 2 ../a' -mkdir dir -cd dir -hg parents -r 2 ../a - -echo '% hg parents -r 2 path:a' -hg parents -r 2 path:a - -echo '% hg parents -r 2 glob:a' -cd .. -hg parents -r 2 glob:a - -echo % merge working dir with 2 parents, hg parents c -HGMERGE=true hg merge -hg parents c - -echo % merge working dir with 1 parent, hg parents -hg up -C 2 -HGMERGE=true hg merge -r 4 -hg parents -echo % merge working dir with 1 parent, hg parents c -hg parents c - -true
--- a/tests/test-parents.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -% no working directory -adding a -adding b -adding c -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -adding c -created new head -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -% hg parents -changeset: 3:02d851b7e549 -user: test -date: Thu Jan 01 00:00:03 1970 +0000 -summary: c - -% hg parents a -changeset: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:01 1970 +0000 -summary: a - -% hg parents c, single revision -changeset: 3:02d851b7e549 -user: test -date: Thu Jan 01 00:00:03 1970 +0000 -summary: c - -% hg parents -r 3 c -abort: 'c' not found in manifest! -% hg parents -r 2 -changeset: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:01 1970 +0000 -summary: a - -% hg parents -r 2 a -changeset: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:01 1970 +0000 -summary: a - -% hg parents -r 2 ../a -abort: ../a not under root -% cd dir; hg parents -r 2 ../a -changeset: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:01 1970 +0000 -summary: a - -% hg parents -r 2 path:a -changeset: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:01 1970 +0000 -summary: a - -% hg parents -r 2 glob:a -abort: can only specify an explicit filename -% merge working dir with 2 parents, hg parents c -merging c -0 files updated, 1 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -changeset: 3:02d851b7e549 -user: test -date: Thu Jan 01 00:00:03 1970 +0000 -summary: c - -changeset: 4:48cee28d4b4e -tag: tip -parent: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:04 1970 +0000 -summary: c2 - -% merge working dir with 1 parent, hg parents -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -changeset: 2:6cfac479f009 -user: test -date: Thu Jan 01 00:00:02 1970 +0000 -summary: b - -changeset: 4:48cee28d4b4e -tag: tip -parent: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:04 1970 +0000 -summary: c2 - -% merge working dir with 1 parent, hg parents c -changeset: 4:48cee28d4b4e -tag: tip -parent: 1:d786049f033a -user: test -date: Thu Jan 01 00:00:04 1970 +0000 -summary: c2 -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-parents.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,149 @@ +test parents command + + $ hg init repo + $ cd repo + +no working directory + + $ hg parents + + $ echo a > a + $ echo b > b + $ hg ci -Amab -d '0 0' + adding a + adding b + $ echo a >> a + $ hg ci -Ama -d '1 0' + $ echo b >> b + $ hg ci -Amb -d '2 0' + $ echo c > c + $ hg ci -Amc -d '3 0' + adding c + $ hg up -C 1 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo d > c + $ hg ci -Amc2 -d '4 0' + adding c + created new head + $ hg up -C 3 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + + + $ hg parents + changeset: 3:02d851b7e549 + user: test + date: Thu Jan 01 00:00:03 1970 +0000 + summary: c + + + $ hg parents a + changeset: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: a + + +hg parents c, single revision + + $ hg parents c + changeset: 3:02d851b7e549 + user: test + date: Thu Jan 01 00:00:03 1970 +0000 + summary: c + + + $ hg parents -r 3 c + abort: 'c' not found in manifest! + + $ hg parents -r 2 + changeset: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: a + + + $ hg parents -r 2 a + changeset: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: a + + + $ hg parents -r 2 ../a + abort: ../a not under root + + +cd dir; hg parents -r 2 ../a + + $ mkdir dir + $ cd dir + $ hg parents -r 2 ../a + changeset: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: a + + $ hg parents -r 2 path:a + changeset: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:01 1970 +0000 + summary: a + + $ cd .. + + $ hg parents -r 2 glob:a + abort: can only specify an explicit filename + + +merge working dir with 2 parents, hg parents c + + $ HGMERGE=true hg merge + merging c + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg parents c + changeset: 3:02d851b7e549 + user: test + date: Thu Jan 01 00:00:03 1970 +0000 + summary: c + + changeset: 4:48cee28d4b4e + tag: tip + parent: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:04 1970 +0000 + summary: c2 + + + +merge working dir with 1 parent, hg parents + + $ hg up -C 2 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ HGMERGE=true hg merge -r 4 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg parents + changeset: 2:6cfac479f009 + user: test + date: Thu Jan 01 00:00:02 1970 +0000 + summary: b + + changeset: 4:48cee28d4b4e + tag: tip + parent: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:04 1970 +0000 + summary: c2 + + +merge working dir with 1 parent, hg parents c + + $ hg parents c + changeset: 4:48cee28d4b4e + tag: tip + parent: 1:d786049f033a + user: test + date: Thu Jan 01 00:00:04 1970 +0000 + summary: c2 +
--- a/tests/test-patch Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -#!/bin/sh - -cat > patchtool.py <<EOF -import sys -print 'Using custom patch' -if '--binary' in sys.argv: - print '--binary found !' -EOF - -echo "[ui]" >> $HGRCPATH -echo "patch=python ../patchtool.py" >> $HGRCPATH - -hg init a -cd a -echo a > a -hg commit -Ama -d '1 0' -echo b >> a -hg commit -Amb -d '2 0' -cd .. - -# This test check that: -# - custom patch commands with arguments actually works -# - patch code does not try to add weird arguments like -# --binary when custom patch commands are used. For instance -# --binary is added by default under win32. - -echo % check custom patch options are honored -hg --cwd a export -o ../a.diff tip -hg clone -r 0 a b - -hg --cwd b import -v ../a.diff - - - - -
--- a/tests/test-patch.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -adding a -% check custom patch options are honored -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying ../a.diff -Using custom patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-patch.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,41 @@ + $ cat > patchtool.py <<EOF + > import sys + > print 'Using custom patch' + > if '--binary' in sys.argv: + > print '--binary found !' + > EOF + + $ echo "[ui]" >> $HGRCPATH + $ echo "patch=python ../patchtool.py" >> $HGRCPATH + + $ hg init a + $ cd a + $ echo a > a + $ hg commit -Ama -d '1 0' + adding a + $ echo b >> a + $ hg commit -Amb -d '2 0' + $ cd .. + +This test checks that: + - custom patch commands with arguments actually work + - patch code does not try to add weird arguments like + --binary when custom patch commands are used. For instance + --binary is added by default under win32. + +check custom patch options are honored + + $ hg --cwd a export -o ../a.diff tip + $ hg clone -r 0 a b + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ hg --cwd b import -v ../a.diff + applying ../a.diff + Using custom patch +
--- a/tests/test-paths Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#!/bin/sh -hg init a -hg clone a b -cd a -echo '[paths]' >> .hg/hgrc -echo 'dupe = ../b' >> .hg/hgrc -hg in dupe | fgrep '../' -cd .. -hg -R a in dupe | fgrep '../' -true
--- a/tests/test-paths.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -updating to branch default -0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-paths.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,15 @@ + $ hg init a + $ hg clone a b + updating to branch default + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd a + $ echo '[paths]' >> .hg/hgrc + $ echo 'dupe = ../b' >> .hg/hgrc + $ hg in dupe + comparing with .*/test-paths.t/b + no changes found + $ cd .. + $ hg -R a in dupe + comparing with .*/test-paths.t/b + no changes found + $ true
--- a/tests/test-status Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -#!/bin/sh - -hg init repo1 -cd repo1 -mkdir a b a/1 b/1 b/2 -touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 -echo "hg status in repo root:" -hg status -echo "hg status . in repo root:" -hg status . -for dir in a b a/1 b/1 b/2; do - echo "hg status in $dir:" - hg status --cwd "$dir" - echo "hg status . in $dir:" - hg status --cwd "$dir" . - echo "hg status .. in $dir:" - hg status --cwd "$dir" .. -done -cd .. - -hg init repo2 -cd repo2 -touch modified removed deleted ignored -echo "^ignored$" > .hgignore -hg ci -A -m 'initial checkin' -d "1000000 0" -touch modified added unknown ignored -hg add added -hg remove removed -rm deleted -echo "hg status:" -hg status -echo "hg status modified added removed deleted unknown never-existed ignored:" -hg status modified added removed deleted unknown never-existed ignored -hg copy modified copied -echo "hg status -C:" -hg status -C -echo "hg status -A:" -hg status -A -echo "^ignoreddir$" > .hgignore -mkdir ignoreddir -touch ignoreddir/file -echo "hg status ignoreddir/file:" -hg status ignoreddir/file -echo "hg status -i ignoreddir/file:" -hg status -i ignoreddir/file -cd .. - -# check 'status -q' and some combinations -hg init repo3 -cd repo3 -touch modified removed deleted ignored -echo "^ignored$" > .hgignore -hg commit -A -m 'initial checkin' -touch added unknown ignored -hg add added -echo "test" >> modified -hg remove removed -rm deleted -hg copy modified copied - -# Run status with 2 different flags. -# Check if result is the same or different. -# If result is not as expected, raise error -assert() { - hg status $1 > ../a - hg status $2 > ../b - out=`diff ../a ../b` - if [ $? -ne 0 ]; then - out=1 - else - out=0 - fi - if [ $3 -eq 0 ]; then - df="same" - else - df="different" - fi - if [ $out -ne $3 ]; then - echo "Error on $1 and $2, should be $df." - fi -} - -# assert flag1 flag2 [0-same | 1-different] -assert "-q" "-mard" 0 -assert "-A" "-marduicC" 0 -assert "-qA" "-mardcC" 0 -assert "-qAui" "-A" 0 -assert "-qAu" "-marducC" 0 -assert "-qAi" "-mardicC" 0 -assert "-qu" "-u" 0 -assert "-q" "-u" 1 -assert "-m" "-a" 1 -assert "-r" "-d" 1 -cd .. - -hg init repo4 -cd repo4 -touch modified removed deleted -hg ci -q -A -m 'initial checkin' -d "1000000 0" -touch added unknown -hg add added -hg remove removed -rm deleted -echo x > modified -hg copy modified copied -hg ci -m 'test checkin' -d "1000001 0" -rm * -touch unrelated -hg ci -q -A -m 'unrelated checkin' -d "1000002 0" -echo "hg status --change 1:" -hg status --change 1 -echo "hg status --change 1 unrelated:" -hg status --change 1 unrelated -echo "hg status -C --change 1 added modified copied removed deleted:" -hg status -C --change 1 added modified copied removed deleted -echo "hg status -A --change 1" -hg status -A --change 1
--- a/tests/test-status-color Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "color=" >> $HGRCPATH -echo "[color]" >> $HGRCPATH -echo "mode=ansi" >> $HGRCPATH - -hg init repo1 -cd repo1 -mkdir a b a/1 b/1 b/2 -touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 -echo "hg status in repo root:" -hg status --color=always -echo "hg status . in repo root:" -hg status --color=always . -for dir in a b a/1 b/1 b/2; do - echo "hg status in $dir:" - hg status --color=always --cwd "$dir" - echo "hg status . in $dir:" - hg status --color=always --cwd "$dir" . - echo "hg status .. in $dir:" - hg status --color=always --cwd "$dir" .. -done -cd .. - -hg init repo2 -cd repo2 -touch modified removed deleted ignored -echo "^ignored$" > .hgignore -hg ci -A -m 'initial checkin' -d "1000000 0" -touch modified added unknown ignored -hg add added -hg remove removed -rm deleted -echo "hg status:" -hg status --color=always -echo "hg status modified added removed deleted unknown never-existed ignored:" -hg status --color=always modified added removed deleted unknown never-existed ignored -hg copy modified copied -echo "hg status -C:" -hg status --color=always -C -echo "hg status -A:" -hg status --color=always -A -echo "^ignoreddir$" > .hgignore -mkdir ignoreddir -touch ignoreddir/file -echo "hg status ignoreddir/file:" -hg status --color=always ignoreddir/file -echo "hg status -i ignoreddir/file:" -hg status --color=always -i ignoreddir/file -cd .. - -# check 'status -q' and some combinations -hg init repo3 -cd repo3 -touch modified removed deleted ignored -echo "^ignored$" > .hgignore -hg commit -A -m 'initial checkin' -touch added unknown ignored -hg add added -echo "test" >> modified -hg remove removed -rm deleted -hg copy modified copied - -echo "% test unknown color" -hg --config color.status.modified=periwinkle status --color=always - -# Run status with 2 different flags. -# Check if result is the same or different. -# If result is not as expected, raise error -assert() { - hg status --color=always $1 > ../a - hg status --color=always $2 > ../b - out=`diff ../a ../b` - if [ $? -ne 0 ]; then - out=1 - else - out=0 - fi - if [ $3 -eq 0 ]; then - df="same" - else - df="different" - fi - if [ $out -ne $3 ]; then - echo "Error on $1 and $2, should be $df." - fi -} - -# assert flag1 flag2 [0-same | 1-different] -assert "-q" "-mard" 0 -assert "-A" "-marduicC" 0 -assert "-qA" "-mardcC" 0 -assert "-qAui" "-A" 0 -assert "-qAu" "-marducC" 0 -assert "-qAi" "-mardicC" 0 -assert "-qu" "-u" 0 -assert "-q" "-u" 1 -assert "-m" "-a" 1 -assert "-r" "-d" 1 - -cd .. - -# test 'resolve -l' -hg init repo4 -cd repo4 -echo "file a" > a -echo "file b" > b -hg add a b -hg commit -m "initial" -echo "file a change 1" > a -echo "file b change 1" > b -hg commit -m "head 1" -hg update 0 -echo "file a change 2" > a -echo "file b change 2" > b -hg commit -m "head 2" -hg merge -hg resolve -m b -echo "hg resolve with one unresolved, one resolved:" -hg resolve --color=always -l
--- a/tests/test-status-color.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -hg status in repo root: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in repo root: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status in a: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in a: -[0;35;1;4m? 1/in_a_1[0m -[0;35;1;4m? in_a[0m -hg status .. in a: -[0;35;1;4m? 1/in_a_1[0m -[0;35;1;4m? in_a[0m -[0;35;1;4m? ../b/1/in_b_1[0m -[0;35;1;4m? ../b/2/in_b_2[0m -[0;35;1;4m? ../b/in_b[0m -[0;35;1;4m? ../in_root[0m -hg status in b: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in b: -[0;35;1;4m? 1/in_b_1[0m -[0;35;1;4m? 2/in_b_2[0m -[0;35;1;4m? in_b[0m -hg status .. in b: -[0;35;1;4m? ../a/1/in_a_1[0m -[0;35;1;4m? ../a/in_a[0m -[0;35;1;4m? 1/in_b_1[0m -[0;35;1;4m? 2/in_b_2[0m -[0;35;1;4m? in_b[0m -[0;35;1;4m? ../in_root[0m -hg status in a/1: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in a/1: -[0;35;1;4m? in_a_1[0m -hg status .. in a/1: -[0;35;1;4m? in_a_1[0m -[0;35;1;4m? ../in_a[0m -hg status in b/1: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in b/1: -[0;35;1;4m? in_b_1[0m -hg status .. in b/1: -[0;35;1;4m? in_b_1[0m -[0;35;1;4m? ../2/in_b_2[0m -[0;35;1;4m? ../in_b[0m -hg status in b/2: -[0;35;1;4m? a/1/in_a_1[0m -[0;35;1;4m? a/in_a[0m -[0;35;1;4m? b/1/in_b_1[0m -[0;35;1;4m? b/2/in_b_2[0m -[0;35;1;4m? b/in_b[0m -[0;35;1;4m? in_root[0m -hg status . in b/2: -[0;35;1;4m? in_b_2[0m -hg status .. in b/2: -[0;35;1;4m? ../1/in_b_1[0m -[0;35;1;4m? in_b_2[0m -[0;35;1;4m? ../in_b[0m -adding .hgignore -adding deleted -adding modified -adding removed -hg status: -[0;32;1mA added[0m -[0;31;1mR removed[0m -[0;36;1;4m! deleted[0m -[0;35;1;4m? unknown[0m -hg status modified added removed deleted unknown never-existed ignored: -never-existed: No such file or directory -[0;32;1mA added[0m -[0;31;1mR removed[0m -[0;36;1;4m! deleted[0m -[0;35;1;4m? unknown[0m -hg status -C: -[0;32;1mA added[0m -[0;32;1mA copied[0m -[0;0m modified[0m -[0;31;1mR removed[0m -[0;36;1;4m! deleted[0m -[0;35;1;4m? unknown[0m -hg status -A: -[0;32;1mA added[0m -[0;32;1mA copied[0m -[0;0m modified[0m -[0;31;1mR removed[0m -[0;36;1;4m! deleted[0m -[0;35;1;4m? unknown[0m -[0;30;1mI ignored[0m -[0;0mC .hgignore[0m -[0;0mC modified[0m -hg status ignoreddir/file: -hg status -i ignoreddir/file: -[0;30;1mI ignoreddir/file[0m -adding .hgignore -adding deleted -adding modified -adding removed -% test unknown color -ignoring unknown color/effect 'periwinkle' (configured in color.status.modified) -M modified -[0;32;1mA added[0m -[0;32;1mA copied[0m -[0;31;1mR removed[0m -[0;36;1;4m! deleted[0m -[0;35;1;4m? unknown[0m -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -merging a -warning: conflicts during merge. -merging a failed! -merging b -warning: conflicts during merge. -merging b failed! -0 files updated, 0 files merged, 0 files removed, 2 files unresolved -use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon -hg resolve with one unresolved, one resolved: -[0;31;1mU a[0m -[0;32;1mR b[0m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-status-color.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,277 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "color=" >> $HGRCPATH + $ echo "[color]" >> $HGRCPATH + $ echo "mode=ansi" >> $HGRCPATH + + $ hg init repo1 + $ cd repo1 + $ mkdir a b a/1 b/1 b/2 + $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 + +hg status in repo root: + + $ hg status --color=always + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + +hg status . in repo root: + + $ hg status --color=always . + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + + $ hg status --color=always --cwd a + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + $ hg status --color=always --cwd a . + [0;35;1;4m? 1/in_a_1[0m + [0;35;1;4m? in_a[0m + $ hg status --color=always --cwd a .. + [0;35;1;4m? 1/in_a_1[0m + [0;35;1;4m? in_a[0m + [0;35;1;4m? ../b/1/in_b_1[0m + [0;35;1;4m? ../b/2/in_b_2[0m + [0;35;1;4m? ../b/in_b[0m + [0;35;1;4m? ../in_root[0m + + $ hg status --color=always --cwd b + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + $ hg status --color=always --cwd b . + [0;35;1;4m? 1/in_b_1[0m + [0;35;1;4m? 2/in_b_2[0m + [0;35;1;4m? in_b[0m + $ hg status --color=always --cwd b .. + [0;35;1;4m? ../a/1/in_a_1[0m + [0;35;1;4m? ../a/in_a[0m + [0;35;1;4m? 1/in_b_1[0m + [0;35;1;4m? 2/in_b_2[0m + [0;35;1;4m? in_b[0m + [0;35;1;4m? ../in_root[0m + + $ hg status --color=always --cwd a/1 + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + $ hg status --color=always --cwd a/1 . + [0;35;1;4m? in_a_1[0m + $ hg status --color=always --cwd a/1 .. + [0;35;1;4m? in_a_1[0m + [0;35;1;4m? ../in_a[0m + + $ hg status --color=always --cwd b/1 + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + $ hg status --color=always --cwd b/1 . + [0;35;1;4m? in_b_1[0m + $ hg status --color=always --cwd b/1 .. + [0;35;1;4m? in_b_1[0m + [0;35;1;4m? ../2/in_b_2[0m + [0;35;1;4m? ../in_b[0m + + $ hg status --color=always --cwd b/2 + [0;35;1;4m? a/1/in_a_1[0m + [0;35;1;4m? a/in_a[0m + [0;35;1;4m? b/1/in_b_1[0m + [0;35;1;4m? b/2/in_b_2[0m + [0;35;1;4m? b/in_b[0m + [0;35;1;4m? in_root[0m + $ hg status --color=always --cwd b/2 . + [0;35;1;4m? in_b_2[0m + $ hg status --color=always --cwd b/2 .. + [0;35;1;4m? ../1/in_b_1[0m + [0;35;1;4m? in_b_2[0m + [0;35;1;4m? ../in_b[0m + $ cd .. + + $ hg init repo2 + $ cd repo2 + $ touch modified removed deleted ignored + $ echo "^ignored$" > .hgignore + $ hg ci -A -m 'initial checkin' -d "1000000 0" + adding .hgignore + adding deleted + adding modified + adding removed + $ touch modified added unknown ignored + $ hg add added + $ hg remove removed + $ rm deleted + +hg status: + + $ hg status --color=always + [0;32;1mA added[0m + [0;31;1mR removed[0m + [0;36;1;4m! deleted[0m + [0;35;1;4m? unknown[0m + +hg status modified added removed deleted unknown never-existed ignored: + + $ hg status --color=always modified added removed deleted unknown never-existed ignored + never-existed: No such file or directory + [0;32;1mA added[0m + [0;31;1mR removed[0m + [0;36;1;4m! deleted[0m + [0;35;1;4m? unknown[0m + + $ hg copy modified copied + +hg status -C: + + $ hg status --color=always -C + [0;32;1mA added[0m + [0;32;1mA copied[0m + [0;0m modified[0m + [0;31;1mR removed[0m + [0;36;1;4m! deleted[0m + [0;35;1;4m? unknown[0m + +hg status -A: + + $ hg status --color=always -A + [0;32;1mA added[0m + [0;32;1mA copied[0m + [0;0m modified[0m + [0;31;1mR removed[0m + [0;36;1;4m! deleted[0m + [0;35;1;4m? unknown[0m + [0;30;1mI ignored[0m + [0;0mC .hgignore[0m + [0;0mC modified[0m + + + $ echo "^ignoreddir$" > .hgignore + $ mkdir ignoreddir + $ touch ignoreddir/file + +hg status ignoreddir/file: + + $ hg status --color=always ignoreddir/file + +hg status -i ignoreddir/file: + + $ hg status --color=always -i ignoreddir/file + [0;30;1mI ignoreddir/file[0m + $ cd .. + +# check 'status -q' and some combinations + + $ hg init repo3 + $ cd repo3 + $ touch modified removed deleted ignored + $ echo "^ignored$" > .hgignore + $ hg commit -A -m 'initial checkin' + adding .hgignore + adding deleted + adding modified + adding removed + $ touch added unknown ignored + $ hg add added + $ echo "test" >> modified + $ hg remove removed + $ rm deleted + $ hg copy modified copied + +test unknown color + + $ hg --config color.status.modified=periwinkle status --color=always + ignoring unknown color/effect 'periwinkle' (configured in color.status.modified) + M modified + [0;32;1mA added[0m + [0;32;1mA copied[0m + [0;31;1mR removed[0m + [0;36;1;4m! deleted[0m + [0;35;1;4m? unknown[0m + +# Run status with 2 different flags. +# Check if result is the same or different. +# If result is not as expected, raise error + $ assert() { + > hg status --color=always $1 > ../a + > hg status --color=always $2 > ../b + > out=`diff ../a ../b` + > if [ $? -ne 0 ]; then + > out=1 + > else + > out=0 + > fi + > if [ $3 -eq 0 ]; then + > df="same" + > else + > df="different" + > fi + > if [ $out -ne $3 ]; then + > echo "Error on $1 and $2, should be $df." + > fi + > } + +# assert flag1 flag2 [0-same | 1-different] + + $ assert "-q" "-mard" 0 + $ assert "-A" "-marduicC" 0 + $ assert "-qA" "-mardcC" 0 + $ assert "-qAui" "-A" 0 + $ assert "-qAu" "-marducC" 0 + $ assert "-qAi" "-mardicC" 0 + $ assert "-qu" "-u" 0 + $ assert "-q" "-u" 1 + $ assert "-m" "-a" 1 + $ assert "-r" "-d" 1 + $ cd .. + +# test 'resolve -l' + $ hg init repo4 + $ cd repo4 + $ echo "file a" > a + $ echo "file b" > b + $ hg add a b + $ hg commit -m "initial" + $ echo "file a change 1" > a + $ echo "file b change 1" > b + $ hg commit -m "head 1" + $ hg update 0 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo "file a change 2" > a + $ echo "file b change 2" > b + $ hg commit -m "head 2" + created new head + $ hg merge + merging a + warning: conflicts during merge. + merging a failed! + merging b + warning: conflicts during merge. + merging b failed! + 0 files updated, 0 files merged, 0 files removed, 2 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon + $ hg resolve -m b + +hg resolve with one unresolved, one resolved: + + $ hg resolve --color=always -l + [0;31;1mU a[0m + [0;32;1mR b[0m
--- a/tests/test-status.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -hg status in repo root: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in repo root: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status in a: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in a: -? 1/in_a_1 -? in_a -hg status .. in a: -? 1/in_a_1 -? in_a -? ../b/1/in_b_1 -? ../b/2/in_b_2 -? ../b/in_b -? ../in_root -hg status in b: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in b: -? 1/in_b_1 -? 2/in_b_2 -? in_b -hg status .. in b: -? ../a/1/in_a_1 -? ../a/in_a -? 1/in_b_1 -? 2/in_b_2 -? in_b -? ../in_root -hg status in a/1: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in a/1: -? in_a_1 -hg status .. in a/1: -? in_a_1 -? ../in_a -hg status in b/1: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in b/1: -? in_b_1 -hg status .. in b/1: -? in_b_1 -? ../2/in_b_2 -? ../in_b -hg status in b/2: -? a/1/in_a_1 -? a/in_a -? b/1/in_b_1 -? b/2/in_b_2 -? b/in_b -? in_root -hg status . in b/2: -? in_b_2 -hg status .. in b/2: -? ../1/in_b_1 -? in_b_2 -? ../in_b -adding .hgignore -adding deleted -adding modified -adding removed -hg status: -A added -R removed -! deleted -? unknown -hg status modified added removed deleted unknown never-existed ignored: -never-existed: No such file or directory -A added -R removed -! deleted -? unknown -hg status -C: -A added -A copied - modified -R removed -! deleted -? unknown -hg status -A: -A added -A copied - modified -R removed -! deleted -? unknown -I ignored -C .hgignore -C modified -hg status ignoreddir/file: -hg status -i ignoreddir/file: -I ignoreddir/file -adding .hgignore -adding deleted -adding modified -adding removed -hg status --change 1: -M modified -A added -A copied -R removed -hg status --change 1 unrelated: -hg status -C --change 1 added modified copied removed deleted: -M modified -A added -A copied - modified -R removed -hg status -A --change 1 -M modified -A added -A copied - modified -R removed -C deleted
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-status.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,275 @@ + $ hg init repo1 + $ cd repo1 + $ mkdir a b a/1 b/1 b/2 + $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2 + +hg status in repo root: + + $ hg status + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + +hg status . in repo root: + + $ hg status . + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + + $ hg status --cwd a + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ hg status --cwd a . + ? 1/in_a_1 + ? in_a + $ hg status --cwd a .. + ? 1/in_a_1 + ? in_a + ? ../b/1/in_b_1 + ? ../b/2/in_b_2 + ? ../b/in_b + ? ../in_root + + $ hg status --cwd b + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ hg status --cwd b . + ? 1/in_b_1 + ? 2/in_b_2 + ? in_b + $ hg status --cwd b .. + ? ../a/1/in_a_1 + ? ../a/in_a + ? 1/in_b_1 + ? 2/in_b_2 + ? in_b + ? ../in_root + + $ hg status --cwd a/1 + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ hg status --cwd a/1 . + ? in_a_1 + $ hg status --cwd a/1 .. + ? in_a_1 + ? ../in_a + + $ hg status --cwd b/1 + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ hg status --cwd b/1 . + ? in_b_1 + $ hg status --cwd b/1 .. + ? in_b_1 + ? ../2/in_b_2 + ? ../in_b + + $ hg status --cwd b/2 + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root + $ hg status --cwd b/2 . + ? in_b_2 + $ hg status --cwd b/2 .. + ? ../1/in_b_1 + ? in_b_2 + ? ../in_b + $ cd .. + + $ hg init repo2 + $ cd repo2 + $ touch modified removed deleted ignored + $ echo "^ignored$" > .hgignore + $ hg ci -A -m 'initial checkin' -d "1000000 0" + adding .hgignore + adding deleted + adding modified + adding removed + $ touch modified added unknown ignored + $ hg add added + $ hg remove removed + $ rm deleted + +hg status: + + $ hg status + A added + R removed + ! deleted + ? unknown + +hg status modified added removed deleted unknown never-existed ignored: + + $ hg status modified added removed deleted unknown never-existed ignored + never-existed: No such file or directory + A added + R removed + ! deleted + ? unknown + + $ hg copy modified copied + +hg status -C: + + $ hg status -C + A added + A copied + modified + R removed + ! deleted + ? unknown + +hg status -A: + + $ hg status -A + A added + A copied + modified + R removed + ! deleted + ? unknown + I ignored + C .hgignore + C modified + + + $ echo "^ignoreddir$" > .hgignore + $ mkdir ignoreddir + $ touch ignoreddir/file + +hg status ignoreddir/file: + + $ hg status ignoreddir/file + +hg status -i ignoreddir/file: + + $ hg status -i ignoreddir/file + I ignoreddir/file + $ cd .. + +# check 'status -q' and some combinations + + $ hg init repo3 + $ cd repo3 + $ touch modified removed deleted ignored + $ echo "^ignored$" > .hgignore + $ hg commit -A -m 'initial checkin' + adding .hgignore + adding deleted + adding modified + adding removed + $ touch added unknown ignored + $ hg add added + $ echo "test" >> modified + $ hg remove removed + $ rm deleted + $ hg copy modified copied + +# Run status with 2 different flags. +# Check if result is the same or different. +# If result is not as expected, raise error + + $ assert() { + > hg status $1 > ../a + > hg status $2 > ../b + > out=`diff ../a ../b` + > if [ $? -ne 0 ]; then + > out=1 + > else + > out=0 + > fi + > if [ $3 -eq 0 ]; then + > df="same" + > else + > df="different" + > fi + > if [ $out -ne $3 ]; then + > echo "Error on $1 and $2, should be $df." + > fi + > } + +# assert flag1 flag2 [0-same | 1-different] + + $ assert "-q" "-mard" 0 + $ assert "-A" "-marduicC" 0 + $ assert "-qA" "-mardcC" 0 + $ assert "-qAui" "-A" 0 + $ assert "-qAu" "-marducC" 0 + $ assert "-qAi" "-mardicC" 0 + $ assert "-qu" "-u" 0 + $ assert "-q" "-u" 1 + $ assert "-m" "-a" 1 + $ assert "-r" "-d" 1 + $ cd .. + + $ hg init repo4 + $ cd repo4 + $ touch modified removed deleted + $ hg ci -q -A -m 'initial checkin' -d "1000000 0" + $ touch added unknown + $ hg add added + $ hg remove removed + $ rm deleted + $ echo x > modified + $ hg copy modified copied + $ hg ci -m 'test checkin' -d "1000001 0" + $ rm * + $ touch unrelated + $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0" + +hg status --change 1: + + $ hg status --change 1 + M modified + A added + A copied + R removed + +hg status --change 1 unrelated: + + $ hg status --change 1 unrelated + +hg status -C --change 1 added modified copied removed deleted: + + $ hg status -C --change 1 added modified copied removed deleted + M modified + A added + A copied + modified + R removed + +hg status -A --change 1: + + $ hg status -A --change 1 + M modified + A added + A copied + modified + R removed + C deleted
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-subrepo-paths Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,27 @@ +#!/bin/sh + +hg init outer +cd outer + +echo 'sub = http://example.net/libfoo' > .hgsub +hg add .hgsub + +echo '% hg debugsub with no remapping' +hg debugsub + +cat > .hg/hgrc <<EOF +[subpaths] +http://example.net = ssh://localhost +EOF + +echo '% hg debugsub with remapping' +hg debugsub + +echo '% test bad subpaths pattern' +cat > .hg/hgrc <<EOF +[subpaths] +.* = \1 +EOF +hg debugsub 2>&1 | "$TESTDIR/filtertmp.py" + +exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-subrepo-paths.out Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,10 @@ +% hg debugsub with no remapping +path sub + source http://example.net/libfoo + revision +% hg debugsub with remapping +path sub + source ssh://localhost/libfoo + revision +% test bad subpaths pattern +abort: bad subrepository pattern in $HGTMP/test-subrepo-paths/outer/.hg/hgrc:2: invalid group reference
--- a/tests/test-symlink-addremove Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh - -"$TESTDIR/hghave" symlink || exit 80 - -hg init a -cd a - -echo '% directory moved and symlinked' -mkdir foo -touch foo/a -hg ci -Ama -mv foo bar -ln -s bar foo -echo '% now addremove should remove old files' -hg addremove
--- a/tests/test-symlink-addremove.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -% directory moved and symlinked -adding foo/a -% now addremove should remove old files -adding bar/a -adding foo -removing foo/a
--- a/tests/test-symlink-basic Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#!/bin/sh - -"$TESTDIR/hghave" symlink || exit 80 - -hg init a -cd a -ln -s nothing dangling -hg commit -m 'commit symlink without adding' dangling -hg add dangling -hg commit -m 'add symlink' - -hg tip -v -hg manifest --debug -echo '% rev 0:' -$TESTDIR/readlink.py dangling - -rm dangling -ln -s void dangling -hg commit -m 'change symlink' -echo '% rev 1:' -$TESTDIR/readlink.py dangling - -echo '% modifying link' -rm dangling -ln -s empty dangling -$TESTDIR/readlink.py dangling - -echo '% reverting to rev 0:' -hg revert -r 0 -a -$TESTDIR/readlink.py dangling - -echo '% backups:' -$TESTDIR/readlink.py *.orig - -rm *.orig -hg up -C -echo '% copies' -hg cp -v dangling dangling2 -hg st -Cmard -$TESTDIR/readlink.py dangling dangling2 - -echo '% issue995' -hg up -C -mkdir dir -ln -s dir dirlink -hg ci -qAm 'add dirlink' -mkdir newdir -mv dir newdir/dir -mv dirlink newdir/dirlink -hg mv -A dirlink newdir/dirlink
--- a/tests/test-symlink-basic.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -abort: dangling: file not tracked! -changeset: 0:cabd88b706fc -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -files: dangling -description: -add symlink - - -2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling -% rev 0: -dangling -> nothing -% rev 1: -dangling -> void -% modifying link -dangling -> empty -% reverting to rev 0: -reverting dangling -dangling -> nothing -% backups: -dangling.orig -> empty -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% copies -copying dangling to dangling2 -A dangling2 - dangling -dangling -> void -dangling2 -> void -% issue995 -0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-symlink-root Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#!/bin/sh - -"$TESTDIR/hghave" symlink || exit 80 - -hg init a -ln -s a link -cd a -echo foo > foo -hg status -hg status ../link
--- a/tests/test-symlink-root.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -? foo -? foo
--- a/tests/test-symlinks Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -#!/bin/sh -#Test bug regarding symlinks that showed up in hg 0.7 -#Author: Matthew Elder <sseses@gmail.com> - -"$TESTDIR/hghave" symlink || exit 80 - -#make and initialize repo -hg init test; cd test; - -#make a file and a symlink -touch foo; ln -s foo bar; - -#import with addremove -- symlink walking should _not_ screwup. -hg addremove - -#commit -- the symlink should _not_ appear added to dir state -hg commit -m 'initial' - -#add a new file so hg will let me commit again -touch bomb - -#again, symlink should _not_ show up on dir state -hg addremove - -#Assert screamed here before, should go by without consequence -hg commit -m 'is there a bug?' - -cd .. ; rm -r test -hg init test; cd test; - -mkdir dir -touch a.c dir/a.o dir/b.o -# test what happens if we want to trick hg -hg commit -A -m 0 -echo "relglob:*.o" > .hgignore -rm a.c -rm dir/a.o -rm dir/b.o -mkdir dir/a.o -ln -s nonexist dir/b.o -mkfifo a.c -# it should show a.c, dir/a.o and dir/b.o deleted -hg status -hg status a.c - -echo '# test absolute path through symlink outside repo' -cd .. -p=`pwd` -hg init x -ln -s x y -cd x -touch f -hg add f -hg status "$p"/y/f - -echo '# try symlink outside repo to file inside' -ln -s x/f ../z -# this should fail -hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : - -cd .. ; rm -r test -hg init test; cd test; - -echo '# try cloning symlink in a subdir' -echo '1. commit a symlink' -mkdir -p a/b/c -cd a/b/c -ln -s /path/to/symlink/source demo -cd ../../.. -hg stat -hg commit -A -m 'add symlink in a/b/c subdir' -echo '2. clone it' -cd .. -hg clone test testclone - -echo '# git symlink diff' -cd testclone -hg diff --git -r null:tip -hg export --git tip > ../sl.diff -echo '# import git symlink diff' -hg rm a/b/c/demo -hg commit -m'remove link' -hg import ../sl.diff -hg diff --git -r 1:tip
--- a/tests/test-symlinks.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -adding bar -adding foo -adding bomb -adding a.c -adding dir/a.o -adding dir/b.o -M dir/b.o -! a.c -! dir/a.o -? .hgignore -a.c: unsupported file type (type is fifo) -! a.c -# test absolute path through symlink outside repo -A f -# try symlink outside repo to file inside -abort: ../z not under root -# try cloning symlink in a subdir -1. commit a symlink -? a/b/c/demo -adding a/b/c/demo -2. clone it -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -# git symlink diff -diff --git a/a/b/c/demo b/a/b/c/demo -new file mode 120000 ---- /dev/null -+++ b/a/b/c/demo -@@ -0,0 +1,1 @@ -+/path/to/symlink/source -\ No newline at end of file -# import git symlink diff -applying ../sl.diff -diff --git a/a/b/c/demo b/a/b/c/demo -new file mode 120000 ---- /dev/null -+++ b/a/b/c/demo -@@ -0,0 +1,1 @@ -+/path/to/symlink/source -\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-symlinks.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,253 @@ + $ "$TESTDIR/hghave" symlink || exit 80 + +== tests added in 0.7 == + + $ hg init test-symlinks-0.7; cd test-symlinks-0.7; + $ touch foo; ln -s foo bar; + +import with addremove -- symlink walking should _not_ screwup. + + $ hg addremove + adding bar + adding foo + +commit -- the symlink should _not_ appear added to dir state + + $ hg commit -m 'initial' + + $ touch bomb + +again, symlink should _not_ show up on dir state + + $ hg addremove + adding bomb + +Assert screamed here before, should go by without consequence + + $ hg commit -m 'is there a bug?' + $ cd .. + + +== fifo & ignore == + + $ hg init test; cd test; + + $ mkdir dir + $ touch a.c dir/a.o dir/b.o + +test what happens if we want to trick hg + + $ hg commit -A -m 0 + adding a.c + adding dir/a.o + adding dir/b.o + $ echo "relglob:*.o" > .hgignore + $ rm a.c + $ rm dir/a.o + $ rm dir/b.o + $ mkdir dir/a.o + $ ln -s nonexist dir/b.o + $ mkfifo a.c + +it should show a.c, dir/a.o and dir/b.o deleted + + $ hg status + M dir/b.o + ! a.c + ! dir/a.o + ? .hgignore + $ hg status a.c + a.c: unsupported file type (type is fifo) + ! a.c + $ cd .. + + +== symlinks from outside the tree == + +test absolute path through symlink outside repo + + $ p=`pwd` + $ hg init x + $ ln -s x y + $ cd x + $ touch f + $ hg add f + $ hg status "$p"/y/f + A f + +try symlink outside repo to file inside + + $ ln -s x/f ../z + +this should fail + + $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : + abort: ../z not under root + $ cd .. + + +== cloning symlinks == + $ hg init clone; cd clone; + +try cloning symlink in a subdir +1. commit a symlink + + $ mkdir -p a/b/c + $ cd a/b/c + $ ln -s /path/to/symlink/source demo + $ cd ../../.. + $ hg stat + ? a/b/c/demo + $ hg commit -A -m 'add symlink in a/b/c subdir' + adding a/b/c/demo + +2. clone it + + $ cd .. + $ hg clone clone clonedest + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + +== symlink and git diffs == + +git symlink diff + + $ cd clonedest + $ hg diff --git -r null:tip + diff --git a/a/b/c/demo b/a/b/c/demo + new file mode 120000 + --- /dev/null + +++ b/a/b/c/demo + @@ -0,0 +1,1 @@ + +/path/to/symlink/source + \ No newline at end of file + $ hg export --git tip > ../sl.diff + +import git symlink diff + + $ hg rm a/b/c/demo + $ hg commit -m'remove link' + $ hg import ../sl.diff + applying ../sl.diff + $ hg diff --git -r 1:tip + diff --git a/a/b/c/demo b/a/b/c/demo + new file mode 120000 + --- /dev/null + +++ b/a/b/c/demo + @@ -0,0 +1,1 @@ + +/path/to/symlink/source + \ No newline at end of file + +== symlinks and addremove == + +directory moved and symlinked + + $ mkdir foo + $ touch foo/a + $ hg ci -Ama + adding foo/a + $ mv foo bar + $ ln -s bar foo + +now addremove should remove old files + + $ hg addremove + adding bar/a + adding foo + removing foo/a + $ cd .. + +== root of repository is symlinked == + + $ hg init root + $ ln -s root link + $ cd root + $ echo foo > foo + $ hg status + ? foo + $ hg status ../link + ? foo + $ cd .. + + + + + $ hg init b + $ cd b + $ ln -s nothing dangling + $ hg commit -m 'commit symlink without adding' dangling + abort: dangling: file not tracked! + $ hg add dangling + $ hg commit -m 'add symlink' + + $ hg tip -v + changeset: 0:cabd88b706fc + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + files: dangling + description: + add symlink + + + $ hg manifest --debug + 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling + $ $TESTDIR/readlink.py dangling + dangling -> nothing + + $ rm dangling + $ ln -s void dangling + $ hg commit -m 'change symlink' + $ $TESTDIR/readlink.py dangling + dangling -> void + + +modifying link + + $ rm dangling + $ ln -s empty dangling + $ $TESTDIR/readlink.py dangling + dangling -> empty + + +reverting to rev 0: + + $ hg revert -r 0 -a + reverting dangling + $ $TESTDIR/readlink.py dangling + dangling -> nothing + + +backups: + + $ $TESTDIR/readlink.py *.orig + dangling.orig -> empty + $ rm *.orig + $ hg up -C + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + +copies + + $ hg cp -v dangling dangling2 + copying dangling to dangling2 + $ hg st -Cmard + A dangling2 + dangling + $ $TESTDIR/readlink.py dangling dangling2 + dangling -> void + dangling2 -> void + + +issue995 + + $ hg up -C + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkdir dir + $ ln -s dir dirlink + $ hg ci -qAm 'add dirlink' + $ mkdir newdir + $ mv dir newdir/dir + $ mv dirlink newdir/dirlink + $ hg mv -A dirlink newdir/dirlink +
--- a/tests/test-tag Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -#!/bin/sh - -hg init test -cd test - -echo a > a -hg add a -hg commit -m "test" -d "1000000 0" -hg history - -hg tag ' ' - -hg tag -d "1000000 0" "bleah" -hg history - -echo foo >> .hgtags -hg tag -d "1000000 0" "bleah2" || echo "failed" - -hg revert .hgtags -hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed" -hg tag -d "1000000 0" tap nada dot tip null . || echo "failed" -hg tag -d "1000000 0" "bleah" || echo "failed" -hg tag -d "1000000 0" "blecch" "bleah" || echo "failed" - -hg tag -d "1000000 0" --remove "blecch" || echo "failed" -hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || echo "failed" - -hg tag -d "1000000 0" -r 0 "bleah0" -hg tag -l -d "1000000 0" -r 1 "bleah1" -hg tag -d "1000000 0" gack gawk gorp -hg tag -d "1000000 0" -f gack -hg tag -d "1000000 0" --remove gack gorp - -cat .hgtags -cat .hg/localtags - -hg update 0 -hg tag -d "1000000 0" "foobar" -cat .hgtags -cat .hg/localtags - -hg tag -l 'xx -newline' -hg tag -l 'xx:xx' - -echo % cloning local tags -cd .. -hg -R test log -r0:5 -hg clone -q -rbleah1 test test1 -hg -R test1 parents --style=compact -hg clone -q -r5 test#bleah1 test2 -hg -R test2 parents --style=compact -hg clone -q -U test#bleah1 test3 -hg -R test3 parents --style=compact - -cd test -echo % issue 601 -python << EOF -f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close() -f = file('.hg/localtags', 'w'); f.write(last); f.close() -EOF -cat .hg/localtags -hg tag -l localnewline -cat .hg/localtags - -python << EOF -f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close() -f = file('.hgtags', 'w'); f.write(last); f.close() -EOF -hg ci -d '1000000 0' -m'broken manual edit of .hgtags' -cat .hgtags -hg tag -d '1000000 0' newline -cat .hgtags - -echo % tag and branch using same name -hg branch tag-and-branch-same-name -hg ci -m"discouraged" -hg tag tag-and-branch-same-name - -echo '% test custom commit messages' -cat > $HGTMP/editor <<'__EOF__' -#!/bin/sh -echo "custom tag message" > "$1" -echo "second line" >> "$1" -__EOF__ -chmod +x "$HGTMP"/editor -HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e -hg log -l1 --template "{desc}\n"
--- a/tests/test-tag.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -changeset: 0:0acdaf898367 -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: test - -abort: tag names cannot consist entirely of whitespace -changeset: 1:3ecf002a1c57 -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Added tag bleah for changeset 0acdaf898367 - -changeset: 0:0acdaf898367 -tag: bleah -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: test - -abort: working copy of .hgtags is changed (please commit .hgtags manually) -failed -abort: tag names must be unique -failed -abort: the name 'tip' is reserved -failed -abort: tag 'bleah' already exists (use -f to force) -failed -abort: tag 'bleah' already exists (use -f to force) -failed -abort: tag 'blecch' does not exist -failed -abort: tag 'blecch' does not exist -failed -0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah -0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah0 -868cc8fbb43b754ad09fa109885d243fc49adae7 gack -868cc8fbb43b754ad09fa109885d243fc49adae7 gawk -868cc8fbb43b754ad09fa109885d243fc49adae7 gorp -868cc8fbb43b754ad09fa109885d243fc49adae7 gack -3807bcf62c5614cb6c16436b514d7764ca5f1631 gack -3807bcf62c5614cb6c16436b514d7764ca5f1631 gack -0000000000000000000000000000000000000000 gack -868cc8fbb43b754ad09fa109885d243fc49adae7 gorp -0000000000000000000000000000000000000000 gorp -3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar -3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 -abort: '\n' cannot be used in a tag name -abort: ':' cannot be used in a tag name -% cloning local tags -changeset: 0:0acdaf898367 -tag: bleah -tag: bleah0 -tag: foobar -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: test - -changeset: 1:3ecf002a1c57 -tag: bleah1 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Added tag bleah for changeset 0acdaf898367 - -changeset: 2:868cc8fbb43b -tag: gawk -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Added tag bleah0 for changeset 0acdaf898367 - -changeset: 3:3807bcf62c56 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Added tag gack, gawk, gorp for changeset 868cc8fbb43b - -changeset: 4:140c6e8597b4 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Added tag gack for changeset 3807bcf62c56 - -changeset: 5:470a65fa7cc9 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Removed tag gack, gorp - -1[tip] 3ecf002a1c57 1970-01-12 13:46 +0000 test - Added tag bleah for changeset 0acdaf898367 - -5[tip] 470a65fa7cc9 1970-01-12 13:46 +0000 test - Removed tag gack, gorp - -% issue 601 -3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah13ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 -f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline -0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar -6ae703d793c8b1f097116869275ecd97b2977a2b newline -% tag and branch using same name -marked working directory as branch tag-and-branch-same-name -warning: tag tag-and-branch-same-name conflicts with existing branch name -% test custom commit messages -custom tag message -second line
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-tag.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,194 @@ + $ hg init test + $ cd test + + $ echo a > a + $ hg add a + $ hg commit -m "test" -d "1000000 0" + $ hg history + changeset: 0:0acdaf898367 + tag: tip + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: test + + + $ hg tag ' ' + abort: tag names cannot consist entirely of whitespace + + $ hg tag -d "1000000 0" "bleah" + $ hg history + changeset: 1:3ecf002a1c57 + tag: tip + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Added tag bleah for changeset 0acdaf898367 + + changeset: 0:0acdaf898367 + tag: bleah + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: test + + + $ echo foo >> .hgtags + $ hg tag -d "1000000 0" "bleah2" || echo "failed" + abort: working copy of .hgtags is changed (please commit .hgtags manually) + failed + + $ hg revert .hgtags + $ hg tag -d "1000000 0" -r 0 x y z y y z || echo "failed" + abort: tag names must be unique + failed + $ hg tag -d "1000000 0" tap nada dot tip null . || echo "failed" + abort: the name 'tip' is reserved + failed + $ hg tag -d "1000000 0" "bleah" || echo "failed" + abort: tag 'bleah' already exists (use -f to force) + failed + $ hg tag -d "1000000 0" "blecch" "bleah" || echo "failed" + abort: tag 'bleah' already exists (use -f to force) + failed + + $ hg tag -d "1000000 0" --remove "blecch" || echo "failed" + abort: tag 'blecch' does not exist + failed + $ hg tag -d "1000000 0" --remove "bleah" "blecch" "blough" || echo "failed" + abort: tag 'blecch' does not exist + failed + + $ hg tag -d "1000000 0" -r 0 "bleah0" + $ hg tag -l -d "1000000 0" -r 1 "bleah1" + $ hg tag -d "1000000 0" gack gawk gorp + $ hg tag -d "1000000 0" -f gack + $ hg tag -d "1000000 0" --remove gack gorp + + $ cat .hgtags + 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah + 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 bleah0 + 868cc8fbb43b754ad09fa109885d243fc49adae7 gack + 868cc8fbb43b754ad09fa109885d243fc49adae7 gawk + 868cc8fbb43b754ad09fa109885d243fc49adae7 gorp + 868cc8fbb43b754ad09fa109885d243fc49adae7 gack + 3807bcf62c5614cb6c16436b514d7764ca5f1631 gack + 3807bcf62c5614cb6c16436b514d7764ca5f1631 gack + 0000000000000000000000000000000000000000 gack + 868cc8fbb43b754ad09fa109885d243fc49adae7 gorp + 0000000000000000000000000000000000000000 gorp + $ cat .hg/localtags + 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 + + $ hg update 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg tag -d "1000000 0" "foobar" + $ cat .hgtags + 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar + $ cat .hg/localtags + 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 + + $ hg tag -l 'xx + > newline' + abort: '\n' cannot be used in a tag name + $ hg tag -l 'xx:xx' + abort: ':' cannot be used in a tag name + +cloning local tags + + $ cd .. + $ hg -R test log -r0:5 + changeset: 0:0acdaf898367 + tag: bleah + tag: bleah0 + tag: foobar + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: test + + changeset: 1:3ecf002a1c57 + tag: bleah1 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Added tag bleah for changeset 0acdaf898367 + + changeset: 2:868cc8fbb43b + tag: gawk + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Added tag bleah0 for changeset 0acdaf898367 + + changeset: 3:3807bcf62c56 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Added tag gack, gawk, gorp for changeset 868cc8fbb43b + + changeset: 4:140c6e8597b4 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Added tag gack for changeset 3807bcf62c56 + + changeset: 5:470a65fa7cc9 + user: test + date: Mon Jan 12 13:46:40 1970 +0000 + summary: Removed tag gack, gorp + + $ hg clone -q -rbleah1 test test1 + $ hg -R test1 parents --style=compact + 1[tip] 3ecf002a1c57 1970-01-12 13:46 +0000 test + Added tag bleah for changeset 0acdaf898367 + + $ hg clone -q -r5 test#bleah1 test2 + $ hg -R test2 parents --style=compact + 5[tip] 470a65fa7cc9 1970-01-12 13:46 +0000 test + Removed tag gack, gorp + + $ hg clone -q -U test#bleah1 test3 + $ hg -R test3 parents --style=compact + + $ cd test + +issue 601 + + $ python << EOF + > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close() + > f = file('.hg/localtags', 'w'); f.write(last); f.close() + > EOF + $ cat .hg/localtags; echo + 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 + $ hg tag -l localnewline + $ cat .hg/localtags; echo + 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1 + f68b039e72eacbb2e68b0543e1f6e50990aa2bb5 localnewline + + + $ python << EOF + > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close() + > f = file('.hgtags', 'w'); f.write(last); f.close() + > EOF + $ hg ci -d '1000000 0' -m'broken manual edit of .hgtags' + $ cat .hgtags; echo + 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar + $ hg tag -d '1000000 0' newline + $ cat .hgtags; echo + 0acdaf8983679e0aac16e811534eb49d7ee1f2b4 foobar + 6ae703d793c8b1f097116869275ecd97b2977a2b newline + + +tag and branch using same name + + $ hg branch tag-and-branch-same-name + marked working directory as branch tag-and-branch-same-name + $ hg ci -m"discouraged" + $ hg tag tag-and-branch-same-name + warning: tag tag-and-branch-same-name conflicts with existing branch name + +test custom commit messages + + $ cat > $HGTMP/editor <<'__EOF__' + > #!/bin/sh + > echo "custom tag message" > "$1" + > echo "second line" >> "$1" + > __EOF__ + $ chmod +x "$HGTMP"/editor + $ HGEDITOR="'$HGTMP'"/editor hg tag custom-tag -e + $ hg log -l1 --template "{desc}\n" + custom tag message + second line
--- a/tests/test-transplant Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -#!/bin/sh - -cat <<EOF >> $HGRCPATH -[extensions] -transplant= -EOF - -hg init t -cd t -echo r1 > r1 -hg ci -Amr1 -d'0 0' -echo r2 > r2 -hg ci -Amr2 -d'1 0' -hg up 0 - -echo b1 > b1 -hg ci -Amb1 -d '0 0' -echo b2 > b2 -hg ci -Amb2 -d '1 0' -echo b3 > b3 -hg ci -Amb3 -d '2 0' - -hg log --template '{rev} {parents} {desc}\n' - -hg clone . ../rebase -cd ../rebase - -hg up -C 1 -echo '% rebase b onto r1' -hg transplant -a -b tip -hg log --template '{rev} {parents} {desc}\n' - -hg clone ../t ../prune -cd ../prune - -hg up -C 1 -echo '% rebase b onto r1, skipping b2' -hg transplant -a -b tip -p 3 -hg log --template '{rev} {parents} {desc}\n' - -echo '% remote transplant' -hg clone -r 1 ../t ../remote -cd ../remote -hg transplant --log -s ../t 2 4 -hg log --template '{rev} {parents} {desc}\n' - -echo '% skip previous transplants' -hg transplant -s ../t -a -b 4 -hg log --template '{rev} {parents} {desc}\n' - -echo '% skip local changes transplanted to the source' -echo b4 > b4 -hg ci -Amb4 -d '3 0' -hg clone ../t ../pullback -cd ../pullback -hg transplant -s ../remote -a -b tip - -echo '% remote transplant with pull' -hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid -cat ../t.pid >> $DAEMON_PIDS - -hg clone -r 0 ../t ../rp -cd ../rp -hg transplant -s http://localhost:$HGPORT/ 2 4 -hg log --template '{rev} {parents} {desc}\n' - -echo '% transplant --continue' -hg init ../tc -cd ../tc -cat <<EOF > foo -foo -bar -baz -EOF -echo toremove > toremove -hg ci -Amfoo -cat <<EOF > foo -foo2 -bar2 -baz2 -EOF -rm toremove -echo added > added -hg ci -Amfoo2 -echo bar > bar -hg ci -Ambar -echo bar2 >> bar -hg ci -mbar2 -hg up 0 -echo foobar > foo -hg ci -mfoobar -hg transplant 1:3 -# transplant -c shouldn't use an old changeset -hg up -C -rm added -hg transplant 1 -hg transplant --continue -hg transplant 1:3 -hg locate -cd .. - -# Test transplant --merge (issue 1111) -echo % test transplant merge -hg init t1111 -cd t1111 -echo a > a -hg ci -Am adda -echo b >> a -hg ci -m appendb -echo c >> a -hg ci -m appendc -hg up -C 0 -echo d >> a -hg ci -m appendd -echo % tranplant -hg transplant -m 1 -cd .. - -echo '% test transplant into empty repository' -hg init empty -cd empty -hg transplant -s ../t -b tip -a -cd .. - -echo '% test filter' -hg init filter -cd filter -cat <<'EOF' >test-filter -#!/bin/sh -sed 's/r1/r2/' $1 > $1.new -mv $1.new $1 -EOF -chmod +x test-filter -hg transplant -s ../t -b tip -a --filter ./test-filter |\ - sed 's/filtering.*/filtering/g' -hg log --template '{rev} {parents} {desc}\n' -cd .. - -echo '% test filter with failed patch' -cd filter -hg up 0 -echo foo > b1 -hg ci -d '0 0' -Am foo -hg transplant 1 --filter ./test-filter |\ - sed 's/filtering.*/filtering/g' -cd .. - -echo '% test with a win32ext like setup (differing EOLs)' -hg init twin1 -cd twin1 -echo a > a -echo b > b -echo b >> b -hg ci -Am t -echo a > b -echo b >> b -hg ci -m changeb -cd .. - -hg init twin2 -cd twin2 -echo '[patch]' >> .hg/hgrc -echo 'eol = crlf' >> .hg/hgrc -python -c "file('b', 'wb').write('b\r\nb\r\n')" -hg ci -m addb -hg transplant -s ../twin1 tip -python -c "print repr(file('b', 'rb').read())" -cd ..
--- a/tests/test-transplant.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -adding r1 -adding r2 -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -adding b1 -created new head -adding b2 -adding b3 -4 b3 -3 b2 -2 0:17ab29e464c6 b1 -1 r2 -0 r1 -updating to branch default -4 files updated, 0 files merged, 0 files removed, 0 files unresolved -1 files updated, 0 files merged, 3 files removed, 0 files unresolved -% rebase b onto r1 -applying 37a1297eb21b -37a1297eb21b transplanted to e234d668f844 -applying 722f4667af76 -722f4667af76 transplanted to 539f377d78df -applying a53251cdf717 -a53251cdf717 transplanted to ffd6818a3975 -7 b3 -6 b2 -5 1:d11e3596cc1a b1 -4 b3 -3 b2 -2 0:17ab29e464c6 b1 -1 r2 -0 r1 -updating to branch default -4 files updated, 0 files merged, 0 files removed, 0 files unresolved -1 files updated, 0 files merged, 3 files removed, 0 files unresolved -% rebase b onto r1, skipping b2 -applying 37a1297eb21b -37a1297eb21b transplanted to e234d668f844 -applying a53251cdf717 -a53251cdf717 transplanted to 7275fda4d04f -6 b3 -5 1:d11e3596cc1a b1 -4 b3 -3 b2 -2 0:17ab29e464c6 b1 -1 r2 -0 r1 -% remote transplant -requesting all changes -adding changesets -adding manifests -adding file changes -added 2 changesets with 2 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -searching for changes -applying 37a1297eb21b -37a1297eb21b transplanted to c19cf0ccb069 -applying a53251cdf717 -a53251cdf717 transplanted to f7fe5bf98525 -3 b3 -(transplanted from a53251cdf717679d1907b289f991534be05c997a) -2 b1 -(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) -1 r2 -0 r1 -% skip previous transplants -searching for changes -applying 722f4667af76 -722f4667af76 transplanted to 47156cd86c0b -4 b2 -3 b3 -(transplanted from a53251cdf717679d1907b289f991534be05c997a) -2 b1 -(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) -1 r2 -0 r1 -% skip local changes transplanted to the source -adding b4 -updating to branch default -4 files updated, 0 files merged, 0 files removed, 0 files unresolved -searching for changes -applying 4333daefcb15 -4333daefcb15 transplanted to 5f42c04e07cc -% remote transplant with pull -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -searching for changes -searching for changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 1 changes to 1 files -applying a53251cdf717 -a53251cdf717 transplanted to 8d9279348abb -2 b3 -1 b1 -0 r1 -% transplant --continue -adding foo -adding toremove -adding added -removing toremove -adding bar -2 files updated, 0 files merged, 2 files removed, 0 files unresolved -created new head -applying a1e30dd1b8e7 -patching file foo -Hunk #1 FAILED at 0 -1 out of 1 hunks FAILED -- saving rejects to file foo.rej -patch failed to apply -abort: Fix up the merge and run hg transplant --continue -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -applying a1e30dd1b8e7 -patching file foo -Hunk #1 FAILED at 0 -1 out of 1 hunks FAILED -- saving rejects to file foo.rej -patch failed to apply -abort: Fix up the merge and run hg transplant --continue -a1e30dd1b8e7 transplanted as f1563cf27039 -skipping already applied revision 1:a1e30dd1b8e7 -applying 1739ac5f6139 -1739ac5f6139 transplanted to d649c221319f -applying 0282d5fbbe02 -0282d5fbbe02 transplanted to 77418277ccb3 -added -bar -foo -% test transplant merge -adding a -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -created new head -% tranplant -applying 42dc4432fd35 -1:42dc4432fd35 merged at a9f4acbac129 -% test transplant into empty repository -requesting all changes -adding changesets -adding manifests -adding file changes -added 4 changesets with 4 changes to 4 files -% test filter -filtering -applying 17ab29e464c6 -17ab29e464c6 transplanted to e9ffc54ea104 -filtering -applying 37a1297eb21b -37a1297eb21b transplanted to 348b36d0b6a5 -filtering -applying 722f4667af76 -722f4667af76 transplanted to 0aa6979afb95 -filtering -applying a53251cdf717 -a53251cdf717 transplanted to 14f8512272b5 -3 b3 -2 b2 -1 b1 -0 r2 -% test filter with failed patch -0 files updated, 0 files merged, 3 files removed, 0 files unresolved -adding b1 -adding test-filter -created new head -file b1 already exists -1 out of 1 hunks FAILED -- saving rejects to file b1.rej -abort: Fix up the merge and run hg transplant --continue -filtering -applying 348b36d0b6a5 -patch failed to apply -% test with a win32ext like setup (differing EOLs) -adding a -adding b -nothing changed -applying 2e849d776c17 -2e849d776c17 transplanted to 589cea8ba85b -'a\r\nb\r\n'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-transplant.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,353 @@ + $ cat <<EOF >> $HGRCPATH + > [extensions] + > transplant= + > EOF + + $ hg init t + $ cd t + $ echo r1 > r1 + $ hg ci -Amr1 -d'0 0' + adding r1 + $ echo r2 > r2 + $ hg ci -Amr2 -d'1 0' + adding r2 + $ hg up 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + + $ echo b1 > b1 + $ hg ci -Amb1 -d '0 0' + adding b1 + created new head + $ echo b2 > b2 + $ hg ci -Amb2 -d '1 0' + adding b2 + $ echo b3 > b3 + $ hg ci -Amb3 -d '2 0' + adding b3 + + $ hg log --template '{rev} {parents} {desc}\n' + 4 b3 + 3 b2 + 2 0:17ab29e464c6 b1 + 1 r2 + 0 r1 + + $ hg clone . ../rebase + updating to branch default + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../rebase + + $ hg up -C 1 + 1 files updated, 0 files merged, 3 files removed, 0 files unresolved + +rebase b onto r1 + + $ hg transplant -a -b tip + applying 37a1297eb21b + 37a1297eb21b transplanted to e234d668f844 + applying 722f4667af76 + 722f4667af76 transplanted to 539f377d78df + applying a53251cdf717 + a53251cdf717 transplanted to ffd6818a3975 + $ hg log --template '{rev} {parents} {desc}\n' + 7 b3 + 6 b2 + 5 1:d11e3596cc1a b1 + 4 b3 + 3 b2 + 2 0:17ab29e464c6 b1 + 1 r2 + 0 r1 + + $ hg clone ../t ../prune + updating to branch default + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../prune + + $ hg up -C 1 + 1 files updated, 0 files merged, 3 files removed, 0 files unresolved + +rebase b onto r1, skipping b2 + + $ hg transplant -a -b tip -p 3 + applying 37a1297eb21b + 37a1297eb21b transplanted to e234d668f844 + applying a53251cdf717 + a53251cdf717 transplanted to 7275fda4d04f + $ hg log --template '{rev} {parents} {desc}\n' + 6 b3 + 5 1:d11e3596cc1a b1 + 4 b3 + 3 b2 + 2 0:17ab29e464c6 b1 + 1 r2 + 0 r1 + + +remote transplant + + $ hg clone -r 1 ../t ../remote + requesting all changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../remote + $ hg transplant --log -s ../t 2 4 + searching for changes + applying 37a1297eb21b + 37a1297eb21b transplanted to c19cf0ccb069 + applying a53251cdf717 + a53251cdf717 transplanted to f7fe5bf98525 + $ hg log --template '{rev} {parents} {desc}\n' + 3 b3 + (transplanted from a53251cdf717679d1907b289f991534be05c997a) + 2 b1 + (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) + 1 r2 + 0 r1 + +skip previous transplants + + $ hg transplant -s ../t -a -b 4 + searching for changes + applying 722f4667af76 + 722f4667af76 transplanted to 47156cd86c0b + $ hg log --template '{rev} {parents} {desc}\n' + 4 b2 + 3 b3 + (transplanted from a53251cdf717679d1907b289f991534be05c997a) + 2 b1 + (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) + 1 r2 + 0 r1 + +skip local changes transplanted to the source + + $ echo b4 > b4 + $ hg ci -Amb4 -d '3 0' + adding b4 + $ hg clone ../t ../pullback + updating to branch default + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../pullback + $ hg transplant -s ../remote -a -b tip + searching for changes + applying 4333daefcb15 + 4333daefcb15 transplanted to 5f42c04e07cc + + +remote transplant with pull + + $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid + $ cat ../t.pid >> $DAEMON_PIDS + + $ hg clone -r 0 ../t ../rp + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../rp + $ hg transplant -s http://localhost:$HGPORT/ 2 4 + searching for changes + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + applying a53251cdf717 + a53251cdf717 transplanted to 8d9279348abb + $ hg log --template '{rev} {parents} {desc}\n' + 2 b3 + 1 b1 + 0 r1 + +transplant --continue + + $ hg init ../tc + $ cd ../tc + $ cat <<EOF > foo + > foo + > bar + > baz + > EOF + $ echo toremove > toremove + $ hg ci -Amfoo + adding foo + adding toremove + $ cat <<EOF > foo + > foo2 + > bar2 + > baz2 + > EOF + $ rm toremove + $ echo added > added + $ hg ci -Amfoo2 + adding added + removing toremove + $ echo bar > bar + $ hg ci -Ambar + adding bar + $ echo bar2 >> bar + $ hg ci -mbar2 + $ hg up 0 + 2 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo foobar > foo + $ hg ci -mfoobar + created new head + $ hg transplant 1:3 + applying a1e30dd1b8e7 + patching file foo + Hunk #1 FAILED at 0 + 1 out of 1 hunks FAILED -- saving rejects to file foo.rej + patch failed to apply + abort: Fix up the merge and run hg transplant --continue + +transplant -c shouldn't use an old changeset + + $ hg up -C + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ rm added + $ hg transplant 1 + applying a1e30dd1b8e7 + patching file foo + Hunk #1 FAILED at 0 + 1 out of 1 hunks FAILED -- saving rejects to file foo.rej + patch failed to apply + abort: Fix up the merge and run hg transplant --continue + $ hg transplant --continue + a1e30dd1b8e7 transplanted as f1563cf27039 + $ hg transplant 1:3 + skipping already applied revision 1:a1e30dd1b8e7 + applying 1739ac5f6139 + 1739ac5f6139 transplanted to d649c221319f + applying 0282d5fbbe02 + 0282d5fbbe02 transplanted to 77418277ccb3 + $ hg locate + added + bar + foo + $ cd .. + +Test transplant --merge (issue 1111) +test transplant merge + + $ hg init t1111 + $ cd t1111 + $ echo a > a + $ hg ci -Am adda + adding a + $ echo b >> a + $ hg ci -m appendb + $ echo c >> a + $ hg ci -m appendc + $ hg up -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo d >> a + $ hg ci -m appendd + created new head + +tranplant + + $ hg transplant -m 1 + applying 42dc4432fd35 + 1:42dc4432fd35 merged at a9f4acbac129 + $ cd .. + +test transplant into empty repository + + $ hg init empty + $ cd empty + $ hg transplant -s ../t -b tip -a + requesting all changes + adding changesets + adding manifests + adding file changes + added 4 changesets with 4 changes to 4 files + $ cd .. + + +test filter + + $ hg init filter + $ cd filter + $ cat <<'EOF' >test-filter + > #!/bin/sh + > sed 's/r1/r2/' $1 > $1.new + > mv $1.new $1 + > EOF + $ chmod +x test-filter + $ hg transplant -s ../t -b tip -a --filter ./test-filter + filtering .* + applying 17ab29e464c6 + 17ab29e464c6 transplanted to e9ffc54ea104 + filtering .* + applying 37a1297eb21b + 37a1297eb21b transplanted to 348b36d0b6a5 + filtering .* + applying 722f4667af76 + 722f4667af76 transplanted to 0aa6979afb95 + filtering .* + applying a53251cdf717 + a53251cdf717 transplanted to 14f8512272b5 + $ hg log --template '{rev} {parents} {desc}\n' + 3 b3 + 2 b2 + 1 b1 + 0 r2 + $ cd .. + + +test filter with failed patch + + $ cd filter + $ hg up 0 + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + $ echo foo > b1 + $ hg ci -d '0 0' -Am foo + adding b1 + adding test-filter + created new head + $ hg transplant 1 --filter ./test-filter + filtering .* + applying 348b36d0b6a5 + file b1 already exists + 1 out of 1 hunks FAILED -- saving rejects to file b1.rej + patch failed to apply + abort: Fix up the merge and run hg transplant --continue + $ cd .. + + +test with a win32ext like setup (differing EOLs) + + $ hg init twin1 + $ cd twin1 + $ echo a > a + $ echo b > b + $ echo b >> b + $ hg ci -Am t + adding a + adding b + $ echo a > b + $ echo b >> b + $ hg ci -m changeb + $ cd .. + + $ hg init twin2 + $ cd twin2 + $ echo '[patch]' >> .hg/hgrc + $ echo 'eol = crlf' >> .hg/hgrc + $ python -c "file('b', 'wb').write('b\r\nb\r\n')" + $ hg ci -m addb + nothing changed + $ hg transplant -s ../twin1 tip + applying 2e849d776c17 + 2e849d776c17 transplanted to 589cea8ba85b + $ python -c "print repr(file('b', 'rb').read())" + 'a\r\nb\r\n' + $ cd ..
--- a/tests/test-verify Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -#!/bin/sh - -echo % prepare repo -hg init a -cd a -echo "some text" > FOO.txt -echo "another text" > bar.txt -echo "more text" > QUICK.txt -hg add -hg ci -mtest1 - -echo -echo % verify -hg verify - -echo -echo % verify with journal -touch .hg/store/journal -hg verify -rm .hg/store/journal - -echo -echo % introduce some bugs in repo -cd .hg/store/data -mv _f_o_o.txt.i X_f_o_o.txt.i -mv bar.txt.i xbar.txt.i -rm _q_u_i_c_k.txt.i - -echo -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 -dd if=.hg/store/data/a.i of=start bs=1 count=20 2>/dev/null -cat start b > .hg/store/data/a.i - -echo -echo % verify -hg verify - -exit 0
--- a/tests/test-verify.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -% prepare repo -adding FOO.txt -adding QUICK.txt -adding bar.txt - -% verify -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -3 files, 1 changesets, 3 total revisions - -% verify with journal -abandoned transaction found - run hg recover -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -3 files, 1 changesets, 3 total revisions - -% introduce some bugs in repo - -% verify -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files - data/FOO.txt.i@0: missing revlog! - 0: empty or missing FOO.txt - FOO.txt@0: f62022d3d590 in manifests not found - data/QUICK.txt.i@0: missing revlog! - 0: empty or missing QUICK.txt - QUICK.txt@0: 88b857db8eba in manifests not found - data/bar.txt.i@0: missing revlog! - 0: empty or missing bar.txt - bar.txt@0: 256559129457 in manifests not found -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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-verify.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,87 @@ +prepare repo + + $ hg init a + $ cd a + $ echo "some text" > FOO.txt + $ echo "another text" > bar.txt + $ echo "more text" > QUICK.txt + $ hg add + adding FOO.txt + adding QUICK.txt + adding bar.txt + $ hg ci -mtest1 + +verify + + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 3 files, 1 changesets, 3 total revisions + +verify with journal + + $ touch .hg/store/journal + $ hg verify + abandoned transaction found - run hg recover + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 3 files, 1 changesets, 3 total revisions + $ rm .hg/store/journal + +introduce some bugs in repo + + $ cd .hg/store/data + $ mv _f_o_o.txt.i X_f_o_o.txt.i + $ mv bar.txt.i xbar.txt.i + $ rm _q_u_i_c_k.txt.i + + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + data/FOO.txt.i@0: missing revlog! + 0: empty or missing FOO.txt + FOO.txt@0: f62022d3d590 in manifests not found + data/QUICK.txt.i@0: missing revlog! + 0: empty or missing QUICK.txt + QUICK.txt@0: 88b857db8eba in manifests not found + data/bar.txt.i@0: missing revlog! + 0: empty or missing bar.txt + bar.txt@0: 256559129457 in manifests not found + 3 files, 1 changesets, 0 total revisions + 9 integrity errors encountered! + (first damaged changeset appears to be 0) + + $ cd .. + +test revlog corruption + + $ hg init b + $ cd b + + $ touch a + $ hg add a + $ hg ci -m a + + $ echo 'corrupted' > b + $ dd if=.hg/store/data/a.i of=start bs=1 count=20 2>/dev/null + $ cat start b > .hg/store/data/a.i + + $ hg 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) + + $ exit 0
--- a/tests/test-walk Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -#!/bin/sh - -debugwalk() -{ - echo "hg debugwalk $@" - hg debugwalk "$@" - echo -} - -chdir() -{ - echo "cd $@" - cd "$@" - echo -} - -mkdir t -cd t -hg init -mkdir -p beans -for b in kidney navy turtle borlotti black pinto; do - echo $b > beans/$b -done -mkdir -p mammals/Procyonidae -for m in cacomistle coatimundi raccoon; do - echo $m > mammals/Procyonidae/$m -done -echo skunk > mammals/skunk -echo fennel > fennel -echo fenugreek > fenugreek -echo fiddlehead > fiddlehead -echo glob:glob > glob:glob -hg addremove -hg commit -m "commit #0" -d "1000000 0" -debugwalk -debugwalk -I. -chdir mammals -debugwalk -debugwalk -X ../beans -debugwalk -I '*k' -debugwalk -I 'glob:*k' -debugwalk -I 'relglob:*k' -debugwalk -I 'relglob:*k' . -debugwalk -I 're:.*k$' -debugwalk -I 'relre:.*k$' -debugwalk -I 'path:beans' -debugwalk -I 'relpath:../beans' -debugwalk . -debugwalk -I. -debugwalk Procyonidae -chdir Procyonidae -debugwalk . -debugwalk .. -chdir .. -debugwalk ../beans -debugwalk . -debugwalk .hg -debugwalk ../.hg -chdir .. -debugwalk -Ibeans -debugwalk -I '{*,{b,m}*/*}k' -debugwalk 'glob:mammals/../beans/b*' -debugwalk '-X*/Procyonidae' mammals -debugwalk path:mammals -debugwalk .. -debugwalk beans/../.. -debugwalk .hg -debugwalk beans/../.hg -debugwalk beans/../.hg/data -debugwalk beans/.hg -# Don't know how to test absolute paths without always getting a false -# error. -#debugwalk `pwd`/beans -#debugwalk `pwd`/.. -debugwalk glob:\* -debugwalk 'glob:**e' -debugwalk 're:.*[kb]$' -debugwalk path:beans/black -debugwalk path:beans//black -debugwalk relglob:Procyonidae -debugwalk 'relglob:Procyonidae/**' -debugwalk 'relglob:Procyonidae/**' fennel -debugwalk beans 'glob:beans/*' -debugwalk 'glob:mamm**' -debugwalk 'glob:mamm**' fennel -debugwalk 'glob:j*' -debugwalk NOEXIST -mkfifo fifo -debugwalk fifo -rm fenugreek -debugwalk fenugreek -hg rm fenugreek -debugwalk fenugreek -touch new -debugwalk new - -mkdir ignored -touch ignored/file -echo '^ignored$' > .hgignore -debugwalk ignored -debugwalk ignored/file - -chdir .. -debugwalk -R t t/mammals/skunk -mkdir t2 -chdir t2 -debugwalk -R ../t ../t/mammals/skunk -debugwalk --cwd ../t mammals/skunk
--- a/tests/test-walk.out Thu Aug 12 18:10:42 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,303 +0,0 @@ -adding beans/black -adding beans/borlotti -adding beans/kidney -adding beans/navy -adding beans/pinto -adding beans/turtle -adding fennel -adding fenugreek -adding fiddlehead -adding glob:glob -adding mammals/Procyonidae/cacomistle -adding mammals/Procyonidae/coatimundi -adding mammals/Procyonidae/raccoon -adding mammals/skunk -hg debugwalk -f beans/black beans/black -f beans/borlotti beans/borlotti -f beans/kidney beans/kidney -f beans/navy beans/navy -f beans/pinto beans/pinto -f beans/turtle beans/turtle -f fennel fennel -f fenugreek fenugreek -f fiddlehead fiddlehead -f glob:glob glob:glob -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -f mammals/skunk mammals/skunk - -hg debugwalk -I. -f beans/black beans/black -f beans/borlotti beans/borlotti -f beans/kidney beans/kidney -f beans/navy beans/navy -f beans/pinto beans/pinto -f beans/turtle beans/turtle -f fennel fennel -f fenugreek fenugreek -f fiddlehead fiddlehead -f glob:glob glob:glob -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -f mammals/skunk mammals/skunk - -cd mammals - -hg debugwalk -f beans/black ../beans/black -f beans/borlotti ../beans/borlotti -f beans/kidney ../beans/kidney -f beans/navy ../beans/navy -f beans/pinto ../beans/pinto -f beans/turtle ../beans/turtle -f fennel ../fennel -f fenugreek ../fenugreek -f fiddlehead ../fiddlehead -f glob:glob ../glob:glob -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon -f mammals/skunk skunk - -hg debugwalk -X ../beans -f fennel ../fennel -f fenugreek ../fenugreek -f fiddlehead ../fiddlehead -f glob:glob ../glob:glob -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon -f mammals/skunk skunk - -hg debugwalk -I *k -f mammals/skunk skunk - -hg debugwalk -I glob:*k -f mammals/skunk skunk - -hg debugwalk -I relglob:*k -f beans/black ../beans/black -f fenugreek ../fenugreek -f mammals/skunk skunk - -hg debugwalk -I relglob:*k . -f mammals/skunk skunk - -hg debugwalk -I re:.*k$ -f beans/black ../beans/black -f fenugreek ../fenugreek -f mammals/skunk skunk - -hg debugwalk -I relre:.*k$ -f beans/black ../beans/black -f fenugreek ../fenugreek -f mammals/skunk skunk - -hg debugwalk -I path:beans -f beans/black ../beans/black -f beans/borlotti ../beans/borlotti -f beans/kidney ../beans/kidney -f beans/navy ../beans/navy -f beans/pinto ../beans/pinto -f beans/turtle ../beans/turtle - -hg debugwalk -I relpath:../beans -f beans/black ../beans/black -f beans/borlotti ../beans/borlotti -f beans/kidney ../beans/kidney -f beans/navy ../beans/navy -f beans/pinto ../beans/pinto -f beans/turtle ../beans/turtle - -hg debugwalk . -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon -f mammals/skunk skunk - -hg debugwalk -I. -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon -f mammals/skunk skunk - -hg debugwalk Procyonidae -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon - -cd Procyonidae - -hg debugwalk . -f mammals/Procyonidae/cacomistle cacomistle -f mammals/Procyonidae/coatimundi coatimundi -f mammals/Procyonidae/raccoon raccoon - -hg debugwalk .. -f mammals/Procyonidae/cacomistle cacomistle -f mammals/Procyonidae/coatimundi coatimundi -f mammals/Procyonidae/raccoon raccoon -f mammals/skunk ../skunk - -cd .. - -hg debugwalk ../beans -f beans/black ../beans/black -f beans/borlotti ../beans/borlotti -f beans/kidney ../beans/kidney -f beans/navy ../beans/navy -f beans/pinto ../beans/pinto -f beans/turtle ../beans/turtle - -hg debugwalk . -f mammals/Procyonidae/cacomistle Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi Procyonidae/coatimundi -f mammals/Procyonidae/raccoon Procyonidae/raccoon -f mammals/skunk skunk - -hg debugwalk .hg -abort: path 'mammals/.hg' is inside repo 'mammals' - -hg debugwalk ../.hg -abort: path contains illegal component: .hg - -cd .. - -hg debugwalk -Ibeans -f beans/black beans/black -f beans/borlotti beans/borlotti -f beans/kidney beans/kidney -f beans/navy beans/navy -f beans/pinto beans/pinto -f beans/turtle beans/turtle - -hg debugwalk -I {*,{b,m}*/*}k -f beans/black beans/black -f fenugreek fenugreek -f mammals/skunk mammals/skunk - -hg debugwalk glob:mammals/../beans/b* -f beans/black beans/black -f beans/borlotti beans/borlotti - -hg debugwalk -X*/Procyonidae mammals -f mammals/skunk mammals/skunk - -hg debugwalk path:mammals -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -f mammals/skunk mammals/skunk - -hg debugwalk .. -abort: .. not under root - -hg debugwalk beans/../.. -abort: beans/../.. not under root - -hg debugwalk .hg -abort: path contains illegal component: .hg - -hg debugwalk beans/../.hg -abort: path contains illegal component: .hg - -hg debugwalk beans/../.hg/data -abort: path contains illegal component: .hg/data - -hg debugwalk beans/.hg -abort: path 'beans/.hg' is inside repo 'beans' - -hg debugwalk glob:* -f fennel fennel -f fenugreek fenugreek -f fiddlehead fiddlehead -f glob:glob glob:glob - -hg debugwalk glob:**e -f beans/turtle beans/turtle -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle - -hg debugwalk re:.*[kb]$ -f beans/black beans/black -f fenugreek fenugreek -f glob:glob glob:glob -f mammals/skunk mammals/skunk - -hg debugwalk path:beans/black -f beans/black beans/black exact - -hg debugwalk path:beans//black -f beans/black beans/black exact - -hg debugwalk relglob:Procyonidae - -hg debugwalk relglob:Procyonidae/** -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon - -hg debugwalk relglob:Procyonidae/** fennel -f fennel fennel exact -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon - -hg debugwalk beans glob:beans/* -f beans/black beans/black -f beans/borlotti beans/borlotti -f beans/kidney beans/kidney -f beans/navy beans/navy -f beans/pinto beans/pinto -f beans/turtle beans/turtle - -hg debugwalk glob:mamm** -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -f mammals/skunk mammals/skunk - -hg debugwalk glob:mamm** fennel -f fennel fennel exact -f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle -f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi -f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon -f mammals/skunk mammals/skunk - -hg debugwalk glob:j* - -hg debugwalk NOEXIST -NOEXIST: No such file or directory - -hg debugwalk fifo -fifo: unsupported file type (type is fifo) - -hg debugwalk fenugreek -f fenugreek fenugreek exact - -hg debugwalk fenugreek -f fenugreek fenugreek exact - -hg debugwalk new -f new new exact - -hg debugwalk ignored - -hg debugwalk ignored/file -f ignored/file ignored/file exact - -cd .. - -hg debugwalk -R t t/mammals/skunk -f mammals/skunk t/mammals/skunk exact - -cd t2 - -hg debugwalk -R ../t ../t/mammals/skunk -f mammals/skunk ../t/mammals/skunk exact - -hg debugwalk --cwd ../t mammals/skunk -f mammals/skunk mammals/skunk exact -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-walk.t Thu Aug 12 18:08:52 2010 -0500 @@ -0,0 +1,284 @@ + $ mkdir t + $ cd t + $ hg init + $ mkdir -p beans + $ for b in kidney navy turtle borlotti black pinto; do + > echo $b > beans/$b + $ done + $ mkdir -p mammals/Procyonidae + $ for m in cacomistle coatimundi raccoon; do + > echo $m > mammals/Procyonidae/$m + $ done + $ echo skunk > mammals/skunk + $ echo fennel > fennel + $ echo fenugreek > fenugreek + $ echo fiddlehead > fiddlehead + $ echo glob:glob > glob:glob + $ hg addremove + adding beans/black + adding beans/borlotti + adding beans/kidney + adding beans/navy + adding beans/pinto + adding beans/turtle + adding fennel + adding fenugreek + adding fiddlehead + adding glob:glob + adding mammals/Procyonidae/cacomistle + adding mammals/Procyonidae/coatimundi + adding mammals/Procyonidae/raccoon + adding mammals/skunk + $ hg commit -m "commit #0" -d "1000000 0" + + $ hg debugwalk + f beans/black beans/black + f beans/borlotti beans/borlotti + f beans/kidney beans/kidney + f beans/navy beans/navy + f beans/pinto beans/pinto + f beans/turtle beans/turtle + f fennel fennel + f fenugreek fenugreek + f fiddlehead fiddlehead + f glob:glob glob:glob + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + f mammals/skunk mammals/skunk + $ hg debugwalk -I. + f beans/black beans/black + f beans/borlotti beans/borlotti + f beans/kidney beans/kidney + f beans/navy beans/navy + f beans/pinto beans/pinto + f beans/turtle beans/turtle + f fennel fennel + f fenugreek fenugreek + f fiddlehead fiddlehead + f glob:glob glob:glob + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + f mammals/skunk mammals/skunk + + $ cd mammals + $ hg debugwalk + f beans/black ../beans/black + f beans/borlotti ../beans/borlotti + f beans/kidney ../beans/kidney + f beans/navy ../beans/navy + f beans/pinto ../beans/pinto + f beans/turtle ../beans/turtle + f fennel ../fennel + f fenugreek ../fenugreek + f fiddlehead ../fiddlehead + f glob:glob ../glob:glob + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + f mammals/skunk skunk + $ hg debugwalk -X ../beans + f fennel ../fennel + f fenugreek ../fenugreek + f fiddlehead ../fiddlehead + f glob:glob ../glob:glob + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + f mammals/skunk skunk + $ hg debugwalk -I '*k' + f mammals/skunk skunk + $ hg debugwalk -I 'glob:*k' + f mammals/skunk skunk + $ hg debugwalk -I 'relglob:*k' + f beans/black ../beans/black + f fenugreek ../fenugreek + f mammals/skunk skunk + $ hg debugwalk -I 'relglob:*k' . + f mammals/skunk skunk + $ hg debugwalk -I 're:.*k$' + f beans/black ../beans/black + f fenugreek ../fenugreek + f mammals/skunk skunk + $ hg debugwalk -I 'relre:.*k$' + f beans/black ../beans/black + f fenugreek ../fenugreek + f mammals/skunk skunk + $ hg debugwalk -I 'path:beans' + f beans/black ../beans/black + f beans/borlotti ../beans/borlotti + f beans/kidney ../beans/kidney + f beans/navy ../beans/navy + f beans/pinto ../beans/pinto + f beans/turtle ../beans/turtle + $ hg debugwalk -I 'relpath:../beans' + f beans/black ../beans/black + f beans/borlotti ../beans/borlotti + f beans/kidney ../beans/kidney + f beans/navy ../beans/navy + f beans/pinto ../beans/pinto + f beans/turtle ../beans/turtle + $ hg debugwalk . + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + f mammals/skunk skunk + $ hg debugwalk -I. + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + f mammals/skunk skunk + $ hg debugwalk Procyonidae + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + + $ cd Procyonidae + $ hg debugwalk . + f mammals/Procyonidae/cacomistle cacomistle + f mammals/Procyonidae/coatimundi coatimundi + f mammals/Procyonidae/raccoon raccoon + $ hg debugwalk .. + f mammals/Procyonidae/cacomistle cacomistle + f mammals/Procyonidae/coatimundi coatimundi + f mammals/Procyonidae/raccoon raccoon + f mammals/skunk ../skunk + $ cd .. + + $ hg debugwalk ../beans + f beans/black ../beans/black + f beans/borlotti ../beans/borlotti + f beans/kidney ../beans/kidney + f beans/navy ../beans/navy + f beans/pinto ../beans/pinto + f beans/turtle ../beans/turtle + $ hg debugwalk . + f mammals/Procyonidae/cacomistle Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi Procyonidae/coatimundi + f mammals/Procyonidae/raccoon Procyonidae/raccoon + f mammals/skunk skunk + $ hg debugwalk .hg + abort: path 'mammals/.hg' is inside repo 'mammals' + $ hg debugwalk ../.hg + abort: path contains illegal component: .hg + $ cd .. + + $ hg debugwalk -Ibeans + f beans/black beans/black + f beans/borlotti beans/borlotti + f beans/kidney beans/kidney + f beans/navy beans/navy + f beans/pinto beans/pinto + f beans/turtle beans/turtle + $ hg debugwalk -I '{*,{b,m}*/*}k' + f beans/black beans/black + f fenugreek fenugreek + f mammals/skunk mammals/skunk + $ hg debugwalk 'glob:mammals/../beans/b*' + f beans/black beans/black + f beans/borlotti beans/borlotti + $ hg debugwalk '-X*/Procyonidae' mammals + f mammals/skunk mammals/skunk + $ hg debugwalk path:mammals + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + f mammals/skunk mammals/skunk + $ hg debugwalk .. + abort: .. not under root + $ hg debugwalk beans/../.. + abort: beans/../.. not under root + $ hg debugwalk .hg + abort: path contains illegal component: .hg + $ hg debugwalk beans/../.hg + abort: path contains illegal component: .hg + $ hg debugwalk beans/../.hg/data + abort: path contains illegal component: .hg/data + $ hg debugwalk beans/.hg + abort: path 'beans/.hg' is inside repo 'beans' + +Don't know how to test absolute paths without always getting a false +error. +# hg debugwalk `pwd`/beans +# hg debugwalk `pwd`/.. + + $ hg debugwalk glob:\* + f fennel fennel + f fenugreek fenugreek + f fiddlehead fiddlehead + f glob:glob glob:glob + $ hg debugwalk 'glob:**e' + f beans/turtle beans/turtle + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + $ hg debugwalk 're:.*[kb]$' + f beans/black beans/black + f fenugreek fenugreek + f glob:glob glob:glob + f mammals/skunk mammals/skunk + $ hg debugwalk path:beans/black + f beans/black beans/black exact + $ hg debugwalk path:beans//black + f beans/black beans/black exact + $ hg debugwalk relglob:Procyonidae + $ hg debugwalk 'relglob:Procyonidae/**' + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + $ hg debugwalk 'relglob:Procyonidae/**' fennel + f fennel fennel exact + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + $ hg debugwalk beans 'glob:beans/*' + f beans/black beans/black + f beans/borlotti beans/borlotti + f beans/kidney beans/kidney + f beans/navy beans/navy + f beans/pinto beans/pinto + f beans/turtle beans/turtle + $ hg debugwalk 'glob:mamm**' + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + f mammals/skunk mammals/skunk + $ hg debugwalk 'glob:mamm**' fennel + f fennel fennel exact + f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle + f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi + f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon + f mammals/skunk mammals/skunk + $ hg debugwalk 'glob:j*' + $ hg debugwalk NOEXIST + NOEXIST: No such file or directory + + $ mkfifo fifo + $ hg debugwalk fifo + fifo: unsupported file type (type is fifo) + + $ rm fenugreek + $ hg debugwalk fenugreek + f fenugreek fenugreek exact + $ hg rm fenugreek + $ hg debugwalk fenugreek + f fenugreek fenugreek exact + $ touch new + $ hg debugwalk new + f new new exact + + $ mkdir ignored + $ touch ignored/file + $ echo '^ignored$' > .hgignore + $ hg debugwalk ignored + $ hg debugwalk ignored/file + f ignored/file ignored/file exact + + $ cd .. + $ hg debugwalk -R t t/mammals/skunk + f mammals/skunk t/mammals/skunk exact + $ mkdir t2 + $ cd t2 + $ hg debugwalk -R ../t ../t/mammals/skunk + f mammals/skunk ../t/mammals/skunk exact + $ hg debugwalk --cwd ../t mammals/skunk + f mammals/skunk mammals/skunk exact