--- a/contrib/zsh_completion Wed Jul 01 08:51:22 2009 -0300
+++ b/contrib/zsh_completion Wed Jul 01 13:57:01 2009 -0500
@@ -14,7 +14,7 @@
# compinit
#
# Copyright (C) 2005, 2006 Steve Borho <steve@borho.org>
-# Copyright (C) 2006, 2007, 2008 Brendan Cully <brendan@kublai.com>
+# Copyright (C) 2006-9 Brendan Cully <brendan@kublai.com>
#
# Permission is hereby granted, without written agreement and without
# licence or royalty fees, to use, copy, modify, and distribute this
@@ -139,7 +139,7 @@
typeset -gA _hg_alias_list
local hline cmd cmdalias
- _call_program hg hg debugcomplete -v 2>/dev/null | while read -A hline
+ _call_program hg hg debugcomplete -v | while read -A hline
do
cmd=$hline[1]
_hg_cmd_list+=($cmd)
@@ -166,13 +166,26 @@
typeset -a tags
local tag rev
- _hg_cmd tags 2> /dev/null | while read tag
+ _hg_cmd tags | while read tag
do
tags+=(${tag/ # [0-9]#:*})
done
(( $#tags )) && _describe -t tags 'tags' tags
}
+# likely merge candidates
+_hg_mergerevs() {
+ typeset -a heads
+ local myrev
+
+ heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"})
+ # exclude own revision
+ myrev=$(_hg_cmd log -r . --template '{rev}\\n')
+ heads=(${heads:#$myrev})
+
+ (( $#heads )) && _describe -t heads 'heads' heads
+}
+
_hg_files() {
if [[ -n "$_hg_root" ]]
then
@@ -192,7 +205,7 @@
_hg_status() {
[[ -d $PREFIX ]] || PREFIX=$PREFIX:h
- status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
+ status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
}
_hg_unknown() {
@@ -214,11 +227,11 @@
}
_hg_resolve() {
- local rstate rpah
+ local rstate rpath
[[ -d $PREFIX ]] || PREFIX=$PREFIX:h
- _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath
+ _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
do
[[ $rstate == 'R' ]] && resolved_files+=($rpath)
[[ $rstate == 'U' ]] && unresolved_files+=($rpath)
@@ -262,7 +275,7 @@
compset -P '*/'
if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
then
- remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
+ remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
_store_cache "$cacheid" remdirs
fi
_describe -t directories 'remote directory' remdirs -S/
@@ -300,7 +313,7 @@
_hg_paths() {
typeset -a paths pnames
- _hg_cmd paths 2> /dev/null | while read -A pnames
+ _hg_cmd paths | while read -A pnames
do
paths+=($pnames[1])
done
@@ -364,7 +377,8 @@
'--remotecmd[specify hg command to run on the remote side]:')
_hg_cmd() {
- _call_program hg hg "$_hg_cmd_globals[@]" "$@"
+ _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \
+ "$_hg_cmd_globals[@]" "$@" 2> /dev/null
}
_hg_cmd_add() {
@@ -410,6 +424,27 @@
'(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
}
+_hg_cmd_bisect() {
+ _arguments -s -w : $_hg_global_opts \
+ '(-)'{-r,--reset}'[reset bisect state]' \
+ '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
+ '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \
+ '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
+ '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \
+ '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]'
+}
+
+_hg_cmd_branch() {
+ _arguments -s -w : $_hg_global_opts \
+ '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
+ '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
+}
+
+_hg_cmd_branches() {
+ _arguments -s -w : $_hg_global_opts \
+ '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]'
+}
+
_hg_cmd_bundle() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts \
'(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
@@ -564,6 +599,14 @@
':revision:_hg_tags'
}
+_hg_cmd_merge() {
+ _arguments -s -w : $_hg_global_opts \
+ '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
+ '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
+ '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
+ ':revision:_hg_mergerevs'
+}
+
_hg_cmd_outgoing() {
_arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
'(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
@@ -719,11 +762,6 @@
':revision:_hg_tags'
}
-# bisect extension
-_hg_cmd_bisect() {
- _arguments -s -w : $_hg_global_opts ':evaluation:(help init reset next good bad)'
-}
-
# HGK
_hg_cmd_view() {
_arguments -s -w : $_hg_global_opts \
@@ -734,13 +772,13 @@
# MQ
_hg_qseries() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qseries 2>/dev/null)"})
+ patches=(${(f)"$(_hg_cmd qseries)"})
(( $#patches )) && _describe -t hg-patches 'patches' patches
}
_hg_qapplied() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qapplied 2>/dev/null)"})
+ patches=(${(f)"$(_hg_cmd qapplied)"})
if (( $#patches ))
then
patches+=(qbase qtip)
@@ -750,15 +788,27 @@
_hg_qunapplied() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qunapplied 2>/dev/null)"})
+ patches=(${(f)"$(_hg_cmd qunapplied)"})
(( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
}
+# unapplied, including guarded patches
+_hg_qdeletable() {
+ typeset -a unapplied
+ unapplied=(${(f)"$(_hg_cmd qseries)"})
+ for p in $(_hg_cmd qapplied)
+ do
+ unapplied=(${unapplied:#$p})
+ done
+
+ (( $#unapplied )) && _describe -t hg-allunapplied-patches 'all unapplied patches' unapplied
+}
+
_hg_qguards() {
typeset -a guards
local guard
compset -P "+|-"
- _hg_cmd qselect -s 2>/dev/null | while read guard
+ _hg_cmd qselect -s | while read guard
do
guards+=(${guard#(+|-)})
done
@@ -776,7 +826,7 @@
_arguments -s -w : $_hg_global_opts \
'(--keep -k)'{-k,--keep}'[keep patch file]' \
'*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \
- '*:unapplied patch:_hg_qunapplied'
+ '*:unapplied patch:_hg_qdeletable'
}
_hg_cmd_qdiff() {
--- a/hgext/keyword.py Wed Jul 01 08:51:22 2009 -0300
+++ b/hgext/keyword.py Wed Jul 01 13:57:01 2009 -0500
@@ -189,7 +189,8 @@
if found:
notify(msg % f)
self.repo.wwrite(f, data, mf.flags(f))
- self.repo.dirstate.normal(f)
+ if node is None:
+ self.repo.dirstate.normal(f)
self.restrict = False
def shrinktext(self, text):
@@ -460,8 +461,14 @@
def commit(self, text='', user=None, date=None, match=None,
force=False, editor=None, extra={}):
+ # use custom commitctx for user commands
+ # other extensions can still wrap repo.commitctx directly
+ repo.commitctx = self.kwcommitctx
+ return super(kwrepo, self).commit(text, user, date, match, force,
+ editor, extra)
+
+ def kwcommitctx(self, ctx, error=False):
wlock = lock = None
- _p1 = _p2 = None
try:
wlock = self.wlock()
lock = self.lock()
@@ -472,23 +479,17 @@
commithooks[name] = cmd
ui.setconfig('hooks', name, None)
if commithooks:
- # store parents for commit hook environment
- _p1, _p2 = repo.dirstate.parents()
- _p1 = hex(_p1)
- if _p2 == nullid:
- _p2 = ''
- else:
- _p2 = hex(_p2)
+ # store parents for commit hooks
+ p1, p2 = ctx.p1(), ctx.p2()
+ xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
+
+ n = super(kwrepo, self).commitctx(ctx, error)
- n = super(kwrepo, self).commit(text, user, date, match, force,
- editor, extra)
-
- # restore commit hooks
- for name, cmd in commithooks.iteritems():
- ui.setconfig('hooks', name, cmd)
- if n is not None:
- kwt.overwrite(n, True, None)
- repo.hook('commit', node=n, parent1=_p1, parent2=_p2)
+ kwt.overwrite(n, True, None)
+ if commithooks:
+ for name, cmd in commithooks.iteritems():
+ ui.setconfig('hooks', name, cmd)
+ repo.hook('commit', node=n, parent1=xp1, parent2=xp2)
return n
finally:
release(lock, wlock)
--- a/mercurial/cmdutil.py Wed Jul 01 08:51:22 2009 -0300
+++ b/mercurial/cmdutil.py Wed Jul 01 13:57:01 2009 -0500
@@ -265,14 +265,15 @@
def matchfiles(repo, files):
return _match.exact(repo.root, repo.getcwd(), files)
-def findrenames(repo, match=None, threshold=0.5):
+def findrenames(repo, added, removed, threshold):
'''find renamed files -- yields (before, after, score) tuples'''
- added, removed = repo.status(match=match)[1:3]
ctx = repo['.']
for a in added:
aa = repo.wread(a)
bestname, bestscore = None, threshold
for r in removed:
+ if r not in ctx:
+ continue
rr = ctx.filectx(r).data()
# bdiff.blocks() returns blocks of matching lines
@@ -297,7 +298,8 @@
dry_run = opts.get('dry_run')
if similarity is None:
similarity = float(opts.get('similarity') or 0)
- add, remove = [], []
+ # we'd use status here, except handling of symlinks and ignore is tricky
+ added, unknown, deleted, removed = [], [], [], []
audit_path = util.path_auditor(repo.root)
m = match(repo, pats, opts)
for abs in repo.walk(m):
@@ -310,19 +312,25 @@
rel = m.rel(abs)
exact = m.exact(abs)
if good and abs not in repo.dirstate:
- add.append(abs)
+ unknown.append(abs)
if repo.ui.verbose or not exact:
repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
- if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
+ elif repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
or (os.path.isdir(target) and not os.path.islink(target))):
- remove.append(abs)
+ deleted.append(abs)
if repo.ui.verbose or not exact:
repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
+ # for finding renames
+ elif repo.dirstate[abs] == 'r':
+ removed.append(abs)
+ elif repo.dirstate[abs] == 'a':
+ added.append(abs)
if not dry_run:
- repo.remove(remove)
- repo.add(add)
+ repo.remove(deleted)
+ repo.add(unknown)
if similarity > 0:
- for old, new, score in findrenames(repo, m, similarity):
+ for old, new, score in findrenames(repo, added + unknown,
+ removed + deleted, similarity):
if repo.ui.verbose or not m.exact(old) or not m.exact(new):
repo.ui.status(_('recording removal of %s as rename to %s '
'(%d%% similar)\n') %
@@ -1201,12 +1209,12 @@
return commitfunc(ui, repo, message, match(repo, pats, opts), opts)
-def commiteditor(repo, ctx):
+def commiteditor(repo, ctx, subs):
if ctx.description():
return ctx.description()
- return commitforceeditor(repo, ctx)
+ return commitforceeditor(repo, ctx, subs)
-def commitforceeditor(repo, ctx):
+def commitforceeditor(repo, ctx, subs):
edittext = []
modified, added, removed = ctx.modified(), ctx.added(), ctx.removed()
if ctx.description():
@@ -1223,6 +1231,7 @@
if ctx.branch():
edittext.append(_("HG: branch '%s'")
% encoding.tolocal(ctx.branch()))
+ edittext.extend([_("HG: subrepo %s") % s for s in subs])
edittext.extend([_("HG: added %s") % f for f in added])
edittext.extend([_("HG: changed %s") % f for f in modified])
edittext.extend([_("HG: removed %s") % f for f in removed])
--- a/mercurial/commands.py Wed Jul 01 08:51:22 2009 -0300
+++ b/mercurial/commands.py Wed Jul 01 13:57:01 2009 -0500
@@ -419,7 +419,8 @@
the parent of the working directory, negating a previous branch
change.
- Use the command 'hg update' to switch to an existing branch.
+ Use the command 'hg update' to switch to an existing branch. Use
+ 'hg commit --close-branch' to mark this branch as closed.
"""
if opts.get('clean'):
@@ -436,16 +437,19 @@
else:
ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
-def branches(ui, repo, active=False):
+def branches(ui, repo, active=False, closed=False):
"""list repository named branches
List the repository's named branches, indicating which ones are
- inactive. If -a/--active is specified, only show active branches.
-
- A branch is considered active if it contains repository heads.
+ inactive. If -c/--closed is specified, also list branches which have
+ been marked closed (see hg commit --close-branch).
+
+ If -a/--active is specified, only show active branches. A branch
+ is considered active if it contains repository heads.
Use the command 'hg update' to switch to an existing branch.
"""
+
hexfunc = ui.debugflag and hex or short
activebranches = [encoding.tolocal(repo[n].branch())
for n in repo.heads()]
@@ -466,6 +470,8 @@
if isactive:
notice = ''
elif hn not in repo.branchheads(tag, closed=False):
+ if not closed:
+ continue
notice = ' (closed)'
else:
notice = ' (inactive)'
@@ -659,6 +665,7 @@
node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
if not node:
+ ui.status(_("nothing changed\n"))
return
cl = repo.changelog
rev = cl.rev(node)
@@ -1371,7 +1378,8 @@
any descendants on the same branch. A branch head could be a true head
or it could be the last changeset on a branch before a new branch
was created. If none of the branch heads are true heads, the branch
- is considered inactive.
+ is considered inactive. If -c/--closed is specified, also show branch
+ heads marked closed (see hg commit --close-branch).
If STARTREV is specified only those heads (or branch heads) that
are descendants of STARTREV will be displayed.
@@ -3205,7 +3213,9 @@
"branches":
(branches,
[('a', 'active', False,
- _('show only branches that have unmerged heads'))],
+ _('show only branches that have unmerged heads')),
+ ('c', 'closed', False,
+ _('show normal and closed heads'))],
_('[-a]')),
"bundle":
(bundle,
--- a/mercurial/localrepo.py Wed Jul 01 08:51:22 2009 -0300
+++ b/mercurial/localrepo.py Wed Jul 01 13:57:01 2009 -0500
@@ -860,7 +860,6 @@
if (not force and not extra.get("close") and p2 == nullid
and not (changes[0] or changes[1] or changes[2])
and self[None].branch() == self['.'].branch()):
- self.ui.status(_("nothing changed\n"))
return None
ms = merge_.mergestate(self)
@@ -872,7 +871,7 @@
cctx = context.workingctx(self, (p1, p2), text, user, date,
extra, changes)
if editor:
- cctx._text = editor(self, cctx)
+ cctx._text = editor(self, cctx, subs)
# commit subs
if subs:
--- a/mercurial/subrepo.py Wed Jul 01 08:51:22 2009 -0300
+++ b/mercurial/subrepo.py Wed Jul 01 13:57:01 2009 -0500
@@ -122,6 +122,7 @@
localrepo = l
hg = h
+ util.path_auditor(ctx._repo.root)(path)
state = ctx.substate.get(path, nullstate)
if state[0].startswith('['): # future expansion
raise error.Abort('unknown subrepo source %s' % state[0])
--- a/mercurial/verify.py Wed Jul 01 08:51:22 2009 -0300
+++ b/mercurial/verify.py Wed Jul 01 13:57:01 2009 -0500
@@ -229,7 +229,8 @@
err(lr, _("empty or missing copy source revlog %s:%s")
% (rp[0], short(rp[1])), f)
elif rp[1] == nullid:
- warn(_("warning: %s@%s: copy source revision is nullid %s:%s")
+ ui.note(_("warning: %s@%s: copy source"
+ " revision is nullid %s:%s\n")
% (f, lr, rp[0], short(rp[1])))
else:
fl2.rev(rp[1])
--- a/tests/test-addremove Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-addremove Wed Jul 01 13:57:01 2009 -0500
@@ -22,5 +22,6 @@
mv a b
rm c
echo d > d
+hg addremove -n -s 50 # issue 1696
hg addremove -s 50
hg commit -mb
--- a/tests/test-addremove.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-addremove.out Wed Jul 01 13:57:01 2009 -0500
@@ -15,3 +15,8 @@
removing c
adding d
recording removal of a as rename to b (100% similar)
+removing a
+adding b
+removing c
+adding d
+recording removal of a as rename to b (100% similar)
--- a/tests/test-branches Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-branches Wed Jul 01 13:57:01 2009 -0500
@@ -70,6 +70,7 @@
hg commit -d '9 0' --close-branch -m 'close this part branch too'
echo '--- b branch should be inactive'
hg branches
+hg branches -c
hg branches -a
hg heads b
hg heads --closed b
--- a/tests/test-branches.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-branches.out Wed Jul 01 13:57:01 2009 -0500
@@ -108,6 +108,10 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- b branch should be inactive
a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c 6:589736a22561 (inactive)
+a 5:d8cbc61dbaa6 (inactive)
+default 0:19709c5a4e75 (inactive)
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
b 12:2da6583810df (closed)
c 6:589736a22561 (inactive)
a 5:d8cbc61dbaa6 (inactive)
--- a/tests/test-debugcomplete.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-debugcomplete.out Wed Jul 01 13:57:01 2009 -0500
@@ -184,7 +184,7 @@
backout: merge, parent, rev, include, exclude, message, logfile, date, user
bisect: reset, good, bad, skip, command, noupdate
branch: force, clean
-branches: active
+branches: active, closed
bundle: force, rev, base, all, type, ssh, remotecmd
cat: output, rev, decode, include, exclude
copy: after, force, include, exclude, dry-run
--- a/tests/test-patch.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-patch.out Wed Jul 01 13:57:01 2009 -0500
@@ -9,4 +9,3 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
applying ../a.diff
Using custom patch
-nothing changed
--- a/tests/test-rebase-mq-skip.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-rebase-mq-skip.out Wed Jul 01 13:57:01 2009 -0500
@@ -6,7 +6,6 @@
% Rebase
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-nothing changed
saving bundle to
adding branch
adding changesets
--- a/tests/test-rebase-scenario-global.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-rebase-scenario-global.out Wed Jul 01 13:57:01 2009 -0500
@@ -52,7 +52,6 @@
o 0: A
% C onto F - skip of E
-nothing changed
saving bundle to
adding branch
adding changesets
@@ -71,7 +70,6 @@
o 0: A
% D onto C - rebase of a branching point (skip E)
-nothing changed
saving bundle to
adding branch
adding changesets
--- a/tests/test-subrepo.out Wed Jul 01 08:51:22 2009 -0300
+++ b/tests/test-subrepo.out Wed Jul 01 13:57:01 2009 -0500
@@ -3,13 +3,11 @@
% add first sub
adding a
committing subrepository s
-nothing changed
% add sub sub
committing subrepository s
committing subrepository ss
% bump sub rev
committing subrepository s
-nothing changed
% leave sub dirty
committing subrepository s
changeset: 3:1c833a7a9e3a