# HG changeset patch # User Thomas Arendsen Hein # Date 1155899255 -7200 # Node ID 27da6dddd0eead0df0502446b7b7d67815511277 # Parent 13cd2cdeff6a8a143109f276e91a1b9c3c7763fe# Parent ee6ed2b29e1aa4f51d062fa88244e4955ece623a merge with tah diff -r ee6ed2b29e1a -r 27da6dddd0ee hgext/extdiff.py --- a/hgext/extdiff.py Fri Aug 18 13:06:38 2006 +0200 +++ b/hgext/extdiff.py Fri Aug 18 13:07:35 2006 +0200 @@ -5,19 +5,24 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. # -# allow to use external programs to compare revisions, or revision -# with working dir. program is called with two arguments: paths to -# directories containing snapshots of files to compare. +# The `extdiff' Mercurial extension allows you to use external programs +# to compare revisions, or revision with working dir. The external diff +# programs are called with a configurable set of options and two +# non-option arguments: paths to directories containing snapshots of +# files to compare. # -# to enable: +# To enable this extension: # # [extensions] # hgext.extdiff = # -# also allows to configure new diff commands, so you do not need to -# type "hg extdiff -p kdiff3" always. +# The `extdiff' extension also allows to configure new diff commands, so +# you do not need to type "hg extdiff -p kdiff3" always. # # [extdiff] +# # add new command that runs GNU diff(1) in 'context diff' mode +# cmd.cdiff = gdiff +# opts.cdiff = -Nprc5 # # add new command called vdiff, runs kdiff3 # cmd.vdiff = kdiff3 # # add new command called meld, runs meld (no need to name twice) @@ -26,16 +31,23 @@ # #(see http://www.vim.org/scripts/script.php?script_id=102) # cmd.vimdiff = LC_ALL=C gvim -f '+bdel 1 2' '+ execute "DirDiff ".argv(0)." ".argv(1)' # -# you can use -I/-X and list of file or directory names like normal -# "hg diff" command. extdiff makes snapshots of only needed files, so -# compare program will be fast. +# Each custom diff commands can have two parts: a `cmd' and an `opts' +# part. The cmd.xxx option defines the name of an executable program +# that will be run, and opts.xxx defines a set of command-line options +# which will be inserted to the command between the program name and +# the files/directories to diff (i.e. the cdiff example above). +# +# You can use -I/-X and list of file or directory names like normal +# "hg diff" command. The `extdiff' extension makes snapshots of only +# needed files, so running the external diff program will actually be +# pretty fast (at least faster than having to compare the entire tree). from mercurial.demandload import demandload from mercurial.i18n import gettext as _ from mercurial.node import * -demandload(globals(), 'mercurial:commands,util os shutil tempfile') +demandload(globals(), 'mercurial:commands,cmdutil,util os shutil tempfile') -def dodiff(ui, repo, diffcmd, pats, opts): +def dodiff(ui, repo, diffcmd, diffopts, pats, opts): def snapshot_node(files, node): '''snapshot files as of some revision''' changes = repo.changelog.read(node) @@ -79,7 +91,7 @@ return dirname node1, node2 = commands.revpair(ui, repo, opts['rev']) - files, matchfn, anypats = commands.matchpats(repo, pats, opts) + files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) modified, added, removed, deleted, unknown = repo.status( node1, node2, files, match=matchfn)[:5] if not (modified or added or removed): @@ -92,9 +104,12 @@ dir2 = snapshot_node(modified + added, node2) else: dir2 = snapshot_wdir(modified + added) - util.system('%s %s "%s" "%s"' % - (diffcmd, ' '.join(opts['option']), dir1, dir2), - cwd=tmproot) + cmdline = ('%s %s %s %s' % + (util.shellquote(diffcmd), + ' '.join(map(util.shellquote, diffopts)), + util.shellquote(dir1), util.shellquote(dir2))) + ui.debug('running %r in %s\n' % (cmdline, tmproot)) + util.system(cmdline, cwd=tmproot) return 1 finally: ui.note(_('cleaning up temp directory\n')) @@ -104,7 +119,9 @@ '''use external program to diff repository (or selected files) Show differences between revisions for the specified files, using - an external program. The default program used is "diff -Npru". + an external program. The default program used is diff, with + default options "-Npru". + To select a different program, use the -p option. The program will be passed the names of two directories to compare. To pass additional options to the program, use the -o option. These will @@ -115,7 +132,8 @@ specified then that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.''' - return dodiff(ui, repo, opts['program'] or 'diff -Npru', pats, opts) + return dodiff(ui, repo, opts['program'] or 'diff', + opts['option'] or ['-Npru'], pats, opts) cmdtable = { "extdiff": @@ -133,20 +151,24 @@ if not cmd.startswith('cmd.'): continue cmd = cmd[4:] if not path: path = cmd + diffopts = ui.config('extdiff', 'opts.' + cmd, '') + diffopts = diffopts and [diffopts] or [] def save(cmd, path): '''use closure to save diff command to use''' def mydiff(ui, repo, *pats, **opts): - return dodiff(ui, repo, path, pats, opts) - mydiff.__doc__ = '''use %s to diff repository (or selected files) + return dodiff(ui, repo, path, diffopts, pats, opts) + mydiff.__doc__ = '''use %(path)r to diff repository (or selected files) Show differences between revisions for the specified - files, using the %s program. + files, using the %(path)r program. When two revision arguments are given, then changes are shown between those revisions. If only one revision is specified then that revision is compared to the working directory, and, when no revisions are specified, the - working directory files are compared to its parent.''' % (cmd, cmd) + working directory files are compared to its parent.''' % { + 'path': path, + } return mydiff cmdtable[cmd] = (save(cmd, path), cmdtable['extdiff'][1][1:], diff -r ee6ed2b29e1a -r 27da6dddd0ee hgext/hgk.py --- a/hgext/hgk.py Fri Aug 18 13:06:38 2006 +0200 +++ b/hgext/hgk.py Fri Aug 18 13:07:35 2006 +0200 @@ -5,8 +5,9 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import time, sys, signal, os -from mercurial import hg, mdiff, fancyopts, commands, ui, util +from mercurial.demandload import * +demandload(globals(), 'time sys signal os') +demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util') def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, changes=None, text=False): diff -r ee6ed2b29e1a -r 27da6dddd0ee hgext/mq.py --- a/hgext/mq.py Fri Aug 18 13:06:38 2006 +0200 +++ b/hgext/mq.py Fri Aug 18 13:07:35 2006 +0200 @@ -400,39 +400,15 @@ '''Apply patchfile to the working directory. patchfile: file name of patch''' try: - pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') - f = os.popen("%s -d %s -p1 --no-backup-if-mismatch < %s" % - (pp, util.shellquote(repo.root), util.shellquote(patchfile))) - except: - self.ui.warn("patch failed, unable to continue (try -v)\n") - return (None, [], False) - files = [] - fuzz = False - for l in f: - l = l.rstrip('\r\n'); - if self.ui.verbose: - self.ui.warn(l + "\n") - if l[:14] == 'patching file ': - pf = os.path.normpath(util.parse_patch_output(l)) - if pf not in files: - files.append(pf) - printed_file = False - file_str = l - elif l.find('with fuzz') >= 0: - if not printed_file: - self.ui.warn(file_str + '\n') - printed_file = True - self.ui.warn(l + '\n') - fuzz = True - elif l.find('saving rejects to file') >= 0: - self.ui.warn(l + '\n') - elif l.find('FAILED') >= 0: - if not printed_file: - self.ui.warn(file_str + '\n') - printed_file = True - self.ui.warn(l + '\n') + (files, fuzz) = patch.patch(patchfile, self.ui, strip=1, + cwd=repo.root) + except Exception, inst: + self.ui.note(str(inst) + '\n') + if not self.ui.verbose: + self.ui.warn("patch failed, unable to continue (try -v)\n") + return (False, [], False) - return (not f.close(), files, fuzz) + return (True, files.keys(), fuzz) def apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, wlock=None): @@ -506,21 +482,28 @@ tr.close() return (err, n) - def delete(self, repo, patch, force=False): - patch = self.lookup(patch, strict=True) - info = self.isapplied(patch) - if info: - raise util.Abort(_("cannot delete applied patch %s") % patch) - if patch not in self.series: - raise util.Abort(_("patch %s not in series file") % patch) - if force: + def delete(self, repo, patches, keep=False): + realpatches = [] + for patch in patches: + patch = self.lookup(patch, strict=True) + info = self.isapplied(patch) + if info: + raise util.Abort(_("cannot delete applied patch %s") % patch) + if patch not in self.series: + raise util.Abort(_("patch %s not in series file") % patch) + realpatches.append(patch) + + if not keep: r = self.qrepo() if r: - r.remove([patch], True) + r.remove(realpatches, True) else: os.unlink(self.join(patch)) - i = self.find_series(patch) - del self.full_series[i] + + indices = [self.find_series(p) for p in realpatches] + indices.sort() + for i in indices[-1::-1]: + del self.full_series[i] self.parse_series() self.series_dirty = 1 @@ -1300,13 +1283,13 @@ if qrepo: qrepo.add(added) -def delete(ui, repo, patch, **opts): - """remove a patch from the series file +def delete(ui, repo, patch, *patches, **opts): + """remove patches from queue - The patch must not be applied. - With -f, deletes the patch file as well as the series entry.""" + The patches must not be applied. + With -k, the patch files are preserved in the patch directory.""" q = repo.mq - q.delete(repo, patch, force=opts.get('force')) + q.delete(repo, (patch,) + patches, keep=opts.get('keep')) q.save_dirty() return 0 @@ -1464,7 +1447,7 @@ applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded patches will - be deleted. With -f/--force, the folded patch files will + be deleted. With -k/--keep, the folded patch files will not be removed afterwards. The header for each folded patch will be concatenated with @@ -1514,7 +1497,7 @@ q.refresh(repo, msg=message) for patch in patches: - q.delete(repo, patch, force=opts['force']) + q.delete(repo, patch, keep=opts['keep']) q.save_dirty() @@ -1903,14 +1886,14 @@ commands.table["^commit|ci"][1], 'hg qcommit [OPTION]... [FILE]...'), "^qdiff": (diff, [], 'hg qdiff [FILE]...'), - "qdelete": + "qdelete|qremove|qrm": (delete, - [('f', 'force', None, _('delete patch file'))], - 'hg qdelete [-f] PATCH'), + [('k', 'keep', None, _('keep patch file'))], + 'hg qdelete [-k] PATCH'), 'qfold': (fold, [('e', 'edit', None, _('edit patch header')), - ('f', 'force', None, _('delete folded patch files')), + ('k', 'keep', None, _('keep folded patch files')), ('m', 'message', '', _('set patch header to ')), ('l', 'logfile', '', _('set patch header to contents of '))], 'hg qfold [-e] [-m ] [-l -# to = recipient1, recipient2, ... -# cc = cc1, cc2, ... -# bcc = bcc1, bcc2, ... +# [email] +# from = My Name +# to = recipient1, recipient2, ... +# cc = cc1, cc2, ... +# bcc = bcc1, bcc2, ... +# +# Then you can use the "hg email" command to mail a series of changesets +# as a patchbomb. +# +# To avoid sending patches prematurely, it is a good idea to first run +# the "email" command with the "-n" option (test only). You will be +# prompted for an email recipient address, a subject an an introductory +# message describing the patches of your patchbomb. Then when all is +# done, your pager will be fired up once for each patchbomb message, so +# you can verify everything is alright. +# +# The "-m" (mbox) option is also very useful. Instead of previewing +# each patchbomb message in a pager or sending the messages directly, +# it will create a UNIX mailbox file with the patch emails. This +# mailbox file can be previewed with any mail user agent which supports +# UNIX mbox files, i.e. with mutt: +# +# % mutt -R -f mbox +# +# When you are previewing the patchbomb messages, you can use `formail' +# (a utility that is commonly installed as part of the procmail package), +# to send each message out: +# +# % formail -s sendmail -bm -t < mbox +# +# That should be all. Now your patchbomb is on its way out. from mercurial.demandload import * demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils diff -r ee6ed2b29e1a -r 27da6dddd0ee mercurial/commands.py --- a/mercurial/commands.py Fri Aug 18 13:06:38 2006 +0200 +++ b/mercurial/commands.py Fri Aug 18 13:07:35 2006 +0200 @@ -183,49 +183,59 @@ fncache[rev] = matches wanted[rev] = 1 - def iterate(): - class followfilter: - def __init__(self, onlyfirst=False): - self.startrev = -1 - self.roots = [] - self.onlyfirst = onlyfirst - - def match(self, rev): - def realparents(rev): - if self.onlyfirst: - return repo.changelog.parentrevs(rev)[0:1] - else: - return filter(lambda x: x != -1, repo.changelog.parentrevs(rev)) - - if self.startrev == -1: - self.startrev = rev + class followfilter: + def __init__(self, onlyfirst=False): + self.startrev = -1 + self.roots = [] + self.onlyfirst = onlyfirst + + def match(self, rev): + def realparents(rev): + if self.onlyfirst: + return repo.changelog.parentrevs(rev)[0:1] + else: + return filter(lambda x: x != -1, repo.changelog.parentrevs(rev)) + + if self.startrev == -1: + self.startrev = rev + return True + + if rev > self.startrev: + # forward: all descendants + if not self.roots: + self.roots.append(self.startrev) + for parent in realparents(rev): + if parent in self.roots: + self.roots.append(rev) + return True + else: + # backwards: all parents + if not self.roots: + self.roots.extend(realparents(self.startrev)) + if rev in self.roots: + self.roots.remove(rev) + self.roots.extend(realparents(rev)) return True - if rev > self.startrev: - # forward: all descendants - if not self.roots: - self.roots.append(self.startrev) - for parent in realparents(rev): - if parent in self.roots: - self.roots.append(rev) - return True - else: - # backwards: all parents - if not self.roots: - self.roots.extend(realparents(self.startrev)) - if rev in self.roots: - self.roots.remove(rev) - self.roots.extend(realparents(rev)) - return True - - return False - + return False + + # it might be worthwhile to do this in the iterator if the rev range + # is descending and the prune args are all within that range + for rev in opts.get('prune', ()): + rev = repo.changelog.rev(repo.lookup(rev)) + ff = followfilter() + stop = min(revs[0], revs[-1]) + for x in range(rev, stop-1, -1): + if ff.match(x) and wanted.has_key(x): + del wanted[x] + + def iterate(): if follow and not files: ff = followfilter(onlyfirst=opts.get('follow_first')) def want(rev): - if rev not in wanted: - return False - return ff.match(rev) + if ff.match(rev) and rev in wanted: + return True + return False else: def want(rev): return rev in wanted @@ -1672,7 +1682,7 @@ message = None ui.debug(_('message:\n%s\n') % message) - files = patch.patch(strip, tmpname, ui, cwd=repo.root) + files, fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root) removes = [] if len(files) > 0: cfiles = files.keys() @@ -1960,9 +1970,29 @@ requested revision. Files that changed between either parent are marked as changed for the next commit and a commit must be performed before any further updates are allowed. + + If no revision is specified, the working directory's parent is a + head revision, and the repository contains exactly one other head, + the other head is merged with by default. Otherwise, an explicit + revision to merge with must be provided. """ - node = _lookup(repo, node, branch) + if node: + node = _lookup(repo, node, branch) + else: + heads = repo.heads() + if len(heads) > 2: + raise util.Abort(_('repo has %d heads - ' + 'please merge with an explicit rev') % + len(heads)) + if len(heads) == 1: + raise util.Abort(_('there is nothing to merge - ' + 'use "hg update" instead')) + parent = repo.dirstate.parents()[0] + if parent not in heads: + raise util.Abort(_('working dir not at a head rev - ' + 'use "hg update" or merge with an explicit rev')) + node = parent == heads[0] and heads[-1] or heads[0] return hg.merge(repo, node, force=force) def outgoing(ui, repo, dest=None, **opts): @@ -2868,6 +2898,7 @@ ('a', 'text', None, _('treat all files as text')), ('p', 'show-function', None, _('show which function each change is in')), + ('g', 'git', None, _('use git extended diff format')), ('w', 'ignore-all-space', None, _('ignore white space when comparing lines')), ('b', 'ignore-space-change', None, @@ -2967,6 +2998,7 @@ ('', 'style', '', _('display using template map file')), ('m', 'only-merges', None, _('show only merges')), ('p', 'patch', None, _('show patch')), + ('P', 'prune', [], _('do not display revision or any of its ancestors')), ('', 'template', '', _('display with template')), ('I', 'include', [], _('include names matching the given patterns')), ('X', 'exclude', [], _('exclude names matching the given patterns'))], diff -r ee6ed2b29e1a -r 27da6dddd0ee mercurial/hgweb/hgweb_mod.py diff -r ee6ed2b29e1a -r 27da6dddd0ee mercurial/mdiff.py --- a/mercurial/mdiff.py Fri Aug 18 13:06:38 2006 +0200 +++ b/mercurial/mdiff.py Fri Aug 18 13:07:35 2006 +0200 @@ -23,6 +23,7 @@ '''context is the number of context lines text treats all files as text showfunc enables diff -p output + git enables the git extended patch format ignorews ignores all whitespace changes in the diff ignorewsamount ignores changes in the amount of whitespace ignoreblanklines ignores changes whose lines are all blank''' @@ -31,6 +32,7 @@ 'context': 3, 'text': False, 'showfunc': True, + 'git': False, 'ignorews': False, 'ignorewsamount': False, 'ignoreblanklines': False, diff -r ee6ed2b29e1a -r 27da6dddd0ee mercurial/patch.py --- a/mercurial/patch.py Fri Aug 18 13:06:38 2006 +0200 +++ b/mercurial/patch.py Fri Aug 18 13:07:35 2006 +0200 @@ -215,13 +215,14 @@ tmpfp.close() return patchname -def patch(strip, patchname, ui, cwd=None): +def patch(patchname, ui, strip=1, cwd=None): """apply the patch to the working directory. a list of patched files is returned""" (dopatch, gitpatches) = readgitpatch(patchname) files = {} + fuzz = False if dopatch: if dopatch == 'filter': patchname = dogitpatch(patchname, gitpatches) @@ -237,10 +238,25 @@ for line in fp: line = line.rstrip() - ui.status("%s\n" % line) + ui.note(line + '\n') if line.startswith('patching file '): pf = util.parse_patch_output(line) + printed_file = False files.setdefault(pf, (None, None)) + elif line.find('with fuzz') >= 0: + fuzz = True + if not printed_file: + ui.warn(pf + '\n') + printed_file = True + ui.warn(line + '\n') + elif line.find('saving rejects to file') >= 0: + ui.warn(line + '\n') + elif line.find('FAILED') >= 0: + if not printed_file: + ui.warn(pf + '\n') + printed_file = True + ui.warn(line + '\n') + code = fp.close() if code: raise util.Abort(_("patch command failed: %s") % @@ -249,11 +265,13 @@ for gp in gitpatches: files[gp.path] = (gp.op, gp) - return files + return (files, fuzz) def diffopts(ui, opts={}): return mdiff.diffopts( text=opts.get('text'), + git=(opts.get('git') or + ui.configbool('diff', 'git', None)), showfunc=(opts.get('show_function') or ui.configbool('diff', 'showfunc', None)), ignorews=(opts.get('ignore_all_space') or @@ -310,6 +328,9 @@ return _date2 def read(f): return repo.file(f).read(mmap2[f]) + def renamed(f): + src = repo.file(f).renamed(mmap2[f]) + return src and src[0] or None else: tz = util.makedate()[1] _date2 = util.datestr() @@ -321,6 +342,8 @@ return _date2 def read(f): return repo.wread(f) + def renamed(f): + return repo.dirstate.copies.get(f) if repo.ui.quiet: r = None @@ -328,16 +351,65 @@ hexfunc = repo.ui.verbose and hex or short r = [hexfunc(node) for node in [node1, node2] if node] + if opts.git: + copied = {} + for f in added: + src = renamed(f) + if src: + copied[f] = src + srcs = [x[1] for x in copied.items()] + all = modified + added + removed all.sort() for f in all: to = None tn = None + dodiff = True if f in mmap: to = repo.file(f).read(mmap[f]) if f not in removed: tn = read(f) - fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts)) + if opts.git: + def gitmode(x): + return x and '100755' or '100644' + def addmodehdr(header, omode, nmode): + if omode != nmode: + header.append('old mode %s\n' % omode) + header.append('new mode %s\n' % nmode) + + a, b = f, f + header = [] + if f in added: + if node2: + mode = gitmode(mmap2.execf(f)) + else: + mode = gitmode(util.is_exec(repo.wjoin(f), None)) + if f in copied: + a = copied[f] + omode = gitmode(mmap.execf(a)) + addmodehdr(header, omode, mode) + op = a in removed and 'rename' or 'copy' + header.append('%s from %s\n' % (op, a)) + header.append('%s to %s\n' % (op, f)) + to = repo.file(a).read(mmap[a]) + else: + header.append('new file mode %s\n' % mode) + elif f in removed: + if f in srcs: + dodiff = False + else: + mode = gitmode(mmap.execf(f)) + header.append('deleted file mode %s\n' % mode) + else: + omode = gitmode(mmap.execf(f)) + nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f))) + addmodehdr(header, omode, nmode) + r = None + if dodiff: + header.insert(0, 'diff --git a/%s b/%s\n' % (a, b)) + fp.write(''.join(header)) + if dodiff: + fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts)) def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, opts=None): diff -r ee6ed2b29e1a -r 27da6dddd0ee mercurial/ui.py diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-annotate --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-annotate Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,23 @@ +#!/bin/sh + +echo % init +hg init + +echo % commit +echo 'a' > a +hg ci -A -m test -u nobody -d '1 0' + +echo % annotate -c +hg annotate -c a + +echo % annotate -d +hg annotate -d a + +echo % annotate -n +hg annotate -n a + +echo % annotate -u +hg annotate -u a + +echo % annotate -cdnu +hg annotate -cdnu a diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-annotate.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-annotate.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,13 @@ +% init +% commit +adding a +% annotate -c +8435f90966e4: a +% annotate -d +Thu Jan 01 00:00:01 1970 +0000: a +% annotate -n +0: a +% annotate -u +nobody: a +% annotate -cdnu +nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-bisect --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-bisect Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +HGRCPATH=$HGTMP/.hgrc; export HGRCPATH +echo "[extensions]" >> $HGTMP/.hgrc +echo "hbisect=" >> $HGTMP/.hgrc + +echo % init +hg init + +echo % committing changes +count=0 +echo > a +while test $count -lt 32 ; do + echo 'a' >> a + test $count -eq 0 && hg add + hg ci -m "msg $count" -d "$count 0" + echo % committed changeset $count + count=$(( $count + 1 )) +done + +echo % log +hg log + +echo % hg up -C +hg up -C + +echo % bisect test +hg bisect init +hg bisect bad +hg bisect good 1 +hg bisect good +hg bisect good +hg bisect good +hg bisect bad +hg bisect good diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-bisect.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-bisect.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,216 @@ +% init +% committing changes +adding a +% committed changeset 0 +% committed changeset 1 +% committed changeset 2 +% committed changeset 3 +% committed changeset 4 +% committed changeset 5 +% committed changeset 6 +% committed changeset 7 +% committed changeset 8 +% committed changeset 9 +% committed changeset 10 +% committed changeset 11 +% committed changeset 12 +% committed changeset 13 +% committed changeset 14 +% committed changeset 15 +% committed changeset 16 +% committed changeset 17 +% committed changeset 18 +% committed changeset 19 +% committed changeset 20 +% committed changeset 21 +% committed changeset 22 +% committed changeset 23 +% committed changeset 24 +% committed changeset 25 +% committed changeset 26 +% committed changeset 27 +% committed changeset 28 +% committed changeset 29 +% committed changeset 30 +% committed changeset 31 +% log +changeset: 31:58c80a7c8a40 +tag: tip +user: test +date: Thu Jan 01 00:00:31 1970 +0000 +summary: msg 31 + +changeset: 30:ed2d2f24b11c +user: test +date: Thu Jan 01 00:00:30 1970 +0000 +summary: msg 30 + +changeset: 29:b5bd63375ab9 +user: test +date: Thu Jan 01 00:00:29 1970 +0000 +summary: msg 29 + +changeset: 28:8e0c2264c8af +user: test +date: Thu Jan 01 00:00:28 1970 +0000 +summary: msg 28 + +changeset: 27:288867a866e9 +user: test +date: Thu Jan 01 00:00:27 1970 +0000 +summary: msg 27 + +changeset: 26:3efc6fd51aeb +user: test +date: Thu Jan 01 00:00:26 1970 +0000 +summary: msg 26 + +changeset: 25:02a84173a97a +user: test +date: Thu Jan 01 00:00:25 1970 +0000 +summary: msg 25 + +changeset: 24:10e0acd3809e +user: test +date: Thu Jan 01 00:00:24 1970 +0000 +summary: msg 24 + +changeset: 23:5ec79163bff4 +user: test +date: Thu Jan 01 00:00:23 1970 +0000 +summary: msg 23 + +changeset: 22:06c7993750ce +user: test +date: Thu Jan 01 00:00:22 1970 +0000 +summary: msg 22 + +changeset: 21:e5db6aa3fe2a +user: test +date: Thu Jan 01 00:00:21 1970 +0000 +summary: msg 21 + +changeset: 20:7128fb4fdbc9 +user: test +date: Thu Jan 01 00:00:20 1970 +0000 +summary: msg 20 + +changeset: 19:52798545b482 +user: test +date: Thu Jan 01 00:00:19 1970 +0000 +summary: msg 19 + +changeset: 18:86977a90077e +user: test +date: Thu Jan 01 00:00:18 1970 +0000 +summary: msg 18 + +changeset: 17:03515f4a9080 +user: test +date: Thu Jan 01 00:00:17 1970 +0000 +summary: msg 17 + +changeset: 16:a2e6ea4973e9 +user: test +date: Thu Jan 01 00:00:16 1970 +0000 +summary: msg 16 + +changeset: 15:e7fa0811edb0 +user: test +date: Thu Jan 01 00:00:15 1970 +0000 +summary: msg 15 + +changeset: 14:ce8f0998e922 +user: test +date: Thu Jan 01 00:00:14 1970 +0000 +summary: msg 14 + +changeset: 13:9d7d07bc967c +user: test +date: Thu Jan 01 00:00:13 1970 +0000 +summary: msg 13 + +changeset: 12:1941b52820a5 +user: test +date: Thu Jan 01 00:00:12 1970 +0000 +summary: msg 12 + +changeset: 11:7b4cd9578619 +user: test +date: Thu Jan 01 00:00:11 1970 +0000 +summary: msg 11 + +changeset: 10:7c5eff49a6b6 +user: test +date: Thu Jan 01 00:00:10 1970 +0000 +summary: msg 10 + +changeset: 9:eb44510ef29a +user: test +date: Thu Jan 01 00:00:09 1970 +0000 +summary: msg 9 + +changeset: 8:453eb4dba229 +user: test +date: Thu Jan 01 00:00:08 1970 +0000 +summary: msg 8 + +changeset: 7:03750880c6b5 +user: test +date: Thu Jan 01 00:00:07 1970 +0000 +summary: msg 7 + +changeset: 6:a3d5c6fdf0d3 +user: test +date: Thu Jan 01 00:00:06 1970 +0000 +summary: msg 6 + +changeset: 5:7874a09ea728 +user: test +date: Thu Jan 01 00:00:05 1970 +0000 +summary: msg 5 + +changeset: 4:9b2ba8336a65 +user: test +date: Thu Jan 01 00:00:04 1970 +0000 +summary: msg 4 + +changeset: 3:b53bea5e2fcb +user: test +date: Thu Jan 01 00:00:03 1970 +0000 +summary: msg 3 + +changeset: 2:db07c04beaca +user: test +date: Thu Jan 01 00:00:02 1970 +0000 +summary: msg 2 + +changeset: 1:5cd978ea5149 +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: msg 1 + +changeset: 0:b99c7b9c8e11 +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: msg 0 + +% hg up -C +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +% bisect test +Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +Testing changeset 27:288867a866e9 (8 changesets remaining, ~3 tests) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +The first bad revision is: +changeset: 29:b5bd63375ab9 +user: test +date: Thu Jan 01 00:00:29 1970 +0000 +summary: msg 29 + diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-extdiff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-extdiff Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,26 @@ +#!/bin/sh + +HGRCPATH=$HGTMP/.hgrc; export HGRCPATH +echo "[extensions]" >> $HGTMP/.hgrc +echo "extdiff=" >> $HGTMP/.hgrc + +hg init a +cd a +echo a > a +hg add +hg extdiff -o -Nr + +echo "[extdiff]" >> $HGTMP/.hgrc +echo "cmd.falabala=echo" >> $HGTMP/.hgrc +echo "opts.falabala=diffing" >> $HGTMP/.hgrc + +hg falabala + +hg help falabala + +hg ci -d '0 0' -mtest1 + +echo b >> a +hg ci -d '1 0' -mtest2 + +hg falabala -r 0:1 || echo "diff-like tools yield a non-zero exit code" diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-extdiff.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-extdiff.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,32 @@ +adding a +making snapshot of 0 files from rev 000000000000 +making snapshot of 1 files from working dir +diff -Nr a.000000000000/a a/a +0a1 +> a +making snapshot of 0 files from rev 000000000000 +making snapshot of 1 files from working dir +diffing a.000000000000 a +hg falabala [OPT]... [FILE]... + +use 'echo' to diff repository (or selected files) + + Show differences between revisions for the specified + files, using the 'echo' program. + + When two revision arguments are given, then changes are + shown between those revisions. If only one revision is + specified then that revision is compared to the working + directory, and, when no revisions are specified, the + working directory files are compared to its parent. + +options: + + -o --option pass option to comparison program + -r --rev revision + -I --include include names matching the given patterns + -X --exclude exclude names matching the given patterns +making snapshot of 1 files from rev e27a2475d60a +making snapshot of 1 files from rev 5e49ec8d3f05 +diffing a.e27a2475d60a a.5e49ec8d3f05 +diff-like tools yield a non-zero exit code diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-git-export --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-git-export Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,46 @@ +#!/bin/sh + +hg init a +cd a + +echo start > start +hg ci -Amstart -d '0 0' +echo new > new +hg ci -Amnew -d '0 0' +echo '% new file' +hg diff --git -r 0 | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" + +hg cp new copy +hg ci -mcopy -d '0 0' +echo '% copy' +hg diff --git -r 1:tip | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" + +hg mv copy rename +hg ci -mrename -d '0 0' +echo '% rename' +hg diff --git -r 2:tip | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" + +hg rm rename +hg ci -mdelete -d '0 0' +echo '% delete' +hg diff --git -r 3:tip | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" + +cat > src <> dst +hg ci -mrenamemod -d '0 0' +echo '% rename+mod+chmod' +hg diff --git -r 6:tip | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-git-export.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-git-export.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,42 @@ +adding start +adding new +% new file +diff --git a/new b/new +new file mode 100644 +--- /dev/null ++++ b/new +@@ -0,0 +1,1 @@ ++new +% copy +diff --git a/new b/copy +copy from new +copy to copy +% rename +diff --git a/copy b/rename +rename from copy +rename to rename +% delete +diff --git a/rename b/rename +deleted file mode 100644 +--- a/rename ++++ /dev/null +@@ -1,1 +0,0 @@ +-new +adding src +% chmod 644 +diff --git a/src b/src +old mode 100644 +new mode 100755 +% rename+mod+chmod +diff --git a/src b/dst +old mode 100755 +new mode 100644 +rename from src +rename to dst +--- a/dst ++++ b/dst +@@ -3,3 +3,4 @@ 3 + 3 + 4 + 5 ++a diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-git-import.out --- a/tests/test-git-import.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-git-import.out Fri Aug 18 13:07:35 2006 +0200 @@ -1,6 +1,5 @@ % new file applying patch from stdin -patching file new % chmod +x applying patch from stdin % copy @@ -14,15 +13,12 @@ rename % delete applying patch from stdin -patching file copyx new rename % regular diff applying patch from stdin -patching file rename % copy and modify applying patch from stdin -patching file copy2 a a b @@ -30,7 +26,6 @@ a % rename and modify applying patch from stdin -patching file rename2 copy2: No such file or directory a a diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-help.out --- a/tests/test-help.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-help.out Fri Aug 18 13:07:35 2006 +0200 @@ -176,6 +176,7 @@ -r --rev revision -a --text treat all files as text -p --show-function show which function each change is in + -g --git use git extended diff format -w --ignore-all-space ignore white space when comparing lines -b --ignore-space-change ignore changes in the amount of white space -B --ignore-blank-lines ignore changes whose lines are all blank diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-import.out --- a/tests/test-import.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-import.out Fri Aug 18 13:07:35 2006 +0200 @@ -8,7 +8,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../tip.patch -patching file a % message should be same summary: second change % committer should be same @@ -21,7 +20,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../tip.patch -patching file a transaction abort! rollback completed % import of plain diff should be ok with message @@ -32,7 +30,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../tip.patch -patching file a % import from stdin requesting all changes adding changesets @@ -41,7 +38,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a % override commit message requesting all changes adding changesets @@ -50,7 +46,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a summary: override % plain diff in email, subject, message body requesting all changes @@ -60,7 +55,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../msg.patch -patching file a user: email patcher summary: email patch % plain diff in email, no subject, message body @@ -71,7 +65,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a % plain diff in email, subject, no message body requesting all changes adding changesets @@ -80,7 +73,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a % plain diff in email, no subject, no message body, should fail requesting all changes adding changesets @@ -89,7 +81,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a transaction abort! rollback completed % hg export in email, should use patch header @@ -100,7 +91,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying patch from stdin -patching file a summary: second change % hg import in a subdirectory requesting all changes @@ -110,7 +100,6 @@ added 1 changesets with 2 changes to 2 files 2 files updated, 0 files merged, 0 files removed, 0 files unresolved applying ../../../tip.patch -patching file a % message should be 'subdir change' summary: subdir change % committer should be 'someoneelse' diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-log --- a/tests/test-log Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-log Fri Aug 18 13:07:35 2006 +0200 @@ -63,3 +63,6 @@ echo % log --follow-first hg log --follow-first + +echo % log -P 2 +hg log -P 2 diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-log.out --- a/tests/test-log.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-log.out Fri Aug 18 13:07:35 2006 +0200 @@ -149,3 +149,29 @@ date: Thu Jan 01 00:00:01 1970 +0000 summary: base +% log -P 2 +changeset: 6:2404bbcab562 +tag: tip +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: b1.1 + +changeset: 5:302e9dd6890d +parent: 3:e62f78d544b4 +parent: 4:ddb82e70d1a1 +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: m12 + +changeset: 4:ddb82e70d1a1 +parent: 0:67e992f2c4f3 +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: b2 + +changeset: 3:e62f78d544b4 +parent: 1:3d5bf5654eda +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: b1 + diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-merge-default --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-merge-default Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,40 @@ +#!/bin/sh + +hg init +echo a > a +hg commit -A -ma + +echo a >> a +hg commit -mb + +echo a >> a +hg commit -mc + +hg up 1 +echo a >> a +hg commit -md + +hg up 1 +echo a >> a +hg commit -me + +hg up 1 +echo % should fail because not at a head +hg merge + +hg up +echo % should fail because \> 2 heads +hg merge + +echo % should succeed +hg merge 2 +hg commit -mm1 + +echo % should succeed - 2 heads +hg merge +hg commit -mm2 + +echo % should fail because 1 head +hg merge + +true diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-merge-default.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-merge-default.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,17 @@ +adding a +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +% should fail because not at a head +abort: repo has 3 heads - please merge with an explicit rev +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +% should fail because > 2 heads +abort: repo has 3 heads - please merge with an explicit rev +% should succeed +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +% should succeed - 2 heads +0 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +% should fail because 1 head +abort: there is nothing to merge - use "hg update" instead diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-mq-qdiff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qdiff Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,28 @@ +#!/bin/sh + +HGRCPATH=$HGTMP/.hgrc; export HGRCPATH +echo "[extensions]" >> $HGTMP/.hgrc +echo "mq=" >> $HGTMP/.hgrc + +echo % init +hg init a +cd a + +echo % commit +echo 'base' > base +hg ci -Ambase -d '1 0' + +echo % qnew mqbase +hg qnew -mmqbase mqbase + +echo % qrefresh +echo 'patched' > base +hg qrefresh + +echo % qdiff +hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" + +echo % qdiff dirname +hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-mq-qdiff.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qdiff.out Fri Aug 18 13:07:35 2006 +0200 @@ -0,0 +1,19 @@ +% init +% commit +adding base +% qnew mqbase +% qrefresh +% qdiff +diff -r 67e992f2c4f3 base +--- a/base ++++ b/base +@@ -1,1 +1,1 @@ base +-base ++patched +% qdiff dirname +diff -r 67e992f2c4f3 base +--- a/base ++++ b/base +@@ -1,1 +1,1 @@ base +-base ++patched diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-mq.out --- a/tests/test-mq.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-mq.out Fri Aug 18 13:07:35 2006 +0200 @@ -27,7 +27,7 @@ qapplied print the patches already applied qclone clone main and patch repository at same time qcommit commit changes in the queue repository - qdelete remove a patch from the series file + qdelete remove patches from queue qdiff diff of the current patch qfold fold the named patches into the current patch qguard set or print guards for a patch diff -r ee6ed2b29e1a -r 27da6dddd0ee tests/test-up-local-change.out --- a/tests/test-up-local-change.out Fri Aug 18 13:06:38 2006 +0200 +++ b/tests/test-up-local-change.out Fri Aug 18 13:07:35 2006 +0200 @@ -43,7 +43,7 @@ date: Mon Jan 12 13:46:40 1970 +0000 summary: 1 -abort: there is nothing to merge, just use 'hg update' or look at 'hg heads' +abort: there is nothing to merge - use "hg update" instead failed changeset: 0:33aaa84a386b user: test