--- a/README Thu Mar 17 17:03:51 2016 -0700
+++ b/README Fri Mar 18 23:49:32 2016 -0700
@@ -56,6 +56,15 @@
Changelog
=========
+5.4.0 --
+
+- Some collaboration with the topic experimental extensions,
+ - hg evolve --all with consider all trouble in your current topic,
+ - preserve 'topic' during evolve,
+ - 'next' and 'prev' restrict themself to the current topic by default,
+ - remove the dangerous 'kill' alias for 'prune' (because 'hg kill -1' without
+ the leading 'hg' will give you an hardtime)
+
5.3.0 -- 2016-02-11
- split: add a new command to split changesets,
--- a/hgext/__init__.py Thu Mar 17 17:03:51 2016 -0700
+++ b/hgext/__init__.py Fri Mar 18 23:49:32 2016 -0700
@@ -1,1 +1,4 @@
-# Copyright 2011 Logilab SA <contact@logilab.fr>
+from __future__ import absolute_import
+import pkgutil
+__path__ = pkgutil.extend_path(__path__, __name__)
+
--- a/hgext/evolve.py Thu Mar 17 17:03:51 2016 -0700
+++ b/hgext/evolve.py Fri Mar 18 23:49:32 2016 -0700
@@ -62,7 +62,6 @@
import sys, os
import random
from StringIO import StringIO
-import struct
import re
import collections
import socket
@@ -1455,9 +1454,14 @@
revs = repo.revs(targetcat+'()')
if revopt:
revs = scmutil.revrange(repo, revopt) & revs
- elif not anyopt and targetcat == 'unstable':
- revs = set(_aspiringdescendant(repo,
- repo.revs('(.::) - obsolete()::')))
+ elif not anyopt:
+ topic = getattr(repo, 'currenttopic', '')
+ if topic:
+ revs = repo.revs('topic(%s)', topic) & revs
+ elif targetcat == 'unstable':
+ revs = _aspiringdescendant(repo,
+ repo.revs('(.::) - obsolete()::'))
+ revs = set(revs)
if targetcat == 'divergent':
# Pick one divergent per group of divergents
revs = _dedupedivergents(repo, revs)
@@ -1645,7 +1649,7 @@
def progresscb():
if revopt or allopt:
- ui.progress(_('evolve'), seen, unit='changesets', total=count)
+ ui.progress(_('evolve'), seen, unit=_('changesets'), total=count)
# Continuation handling
if contopt:
@@ -2027,7 +2031,7 @@
/!\ * hg up to the parent of the amended changeset (which are named W and Z)
/!\ * hg revert --all -r X
/!\ * hg ci -m "same message as the amended changeset" => new cset Y
-/!\ * hg kill -n Y W Z
+/!\ * hg prune -n Y W Z
""")
if progresscb: progresscb()
emtpycommitallowed = repo.ui.backupconfig('ui', 'allowemptycommit')
@@ -2075,6 +2079,7 @@
[('B', 'move-bookmark', False,
_('move active bookmark after update')),
('', 'merge', False, _('bring uncommitted change along')),
+ ('', 'no-topic', False, _('ignore topic and move topologically')),
('n', 'dry-run', False,
_('do not perform actions, just print what would be done'))],
'[OPTION]...')
@@ -2095,8 +2100,14 @@
raise
parents = wparents[0].parents()
+ topic = getattr(repo, 'currenttopic', '')
+ if topic and not opts.get("no_topic", False):
+ parents = [ctx for ctx in parents if ctx.topic() == topic]
displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
- if len(parents) == 1:
+ if not parents:
+ ui.warn(_('no parent in topic "%s"\n') % topic)
+ ui.warn(_('(do you want --no-topic)\n'))
+ elif len(parents) == 1:
p = parents[0]
bm = bmactive(repo)
shouldmove = opts.get('move_bookmark') and bm is not None
@@ -2133,6 +2144,7 @@
_('move active bookmark after update')),
('', 'merge', False, _('bring uncommitted change along')),
('', 'evolve', False, _('evolve the next changeset if necessary')),
+ ('', 'no-topic', False, _('ignore topic and move topologically')),
('n', 'dry-run', False,
_('do not perform actions, just print what would be done'))],
'[OPTION]...')
@@ -2156,6 +2168,12 @@
raise
children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()]
+ topic = getattr(repo, 'currenttopic', '')
+ filtered = []
+ if topic and not opts.get("no_topic", False):
+ filtered = [ctx for ctx in children if ctx.topic() != topic]
+ # XXX N-square membership on children
+ children = [ctx for ctx in children if ctx not in filtered]
displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
if len(children) == 1:
c = children[0]
@@ -2191,8 +2209,17 @@
result = 1
else:
aspchildren = _aspiringchildren(repo, [repo['.'].rev()])
+ if topic:
+ filtered.extend(repo[c] for c in children
+ if repo[c].topic() != topic)
+ # XXX N-square membership on children
+ aspchildren = [ctx for ctx in aspchildren if ctx not in filtered]
if not opts['evolve'] or not aspchildren:
- ui.warn(_('no children\n'))
+ if filtered:
+ ui.warn(_('no children on topic "%s"\n') % topic)
+ ui.warn(_('do you want --no-topic\n'))
+ else:
+ ui.warn(_('no children\n'))
if aspchildren:
msg = _('(%i unstable changesets to be evolved here, '
'do you want --evolve?)\n')
@@ -2272,7 +2299,7 @@
return metadata
-@command('^prune|obsolete|kill',
+@command('^prune|obsolete',
[('n', 'new', [], _("successor changeset (DEPRECATED)")),
('s', 'succ', [], _("successor changeset")),
('r', 'rev', [], _("revisions to prune")),
@@ -3044,7 +3071,7 @@
@eh.extsetup
def oldevolveextsetup(ui):
- for cmd in ['kill', 'uncommit', 'touch', 'fold']:
+ for cmd in ['prune', 'uncommit', 'touch', 'fold']:
try:
entry = extensions.wrapcommand(cmdtable, cmd,
warnobserrors)
@@ -3246,7 +3273,7 @@
undecided.difference_update(common)
- ui.progress(_("comparing with other"), None, total=totalnb)
+ ui.progress(_("comparing with other"), None)
result = dag.headsetofconnecteds(common)
ui.debug("%d total queries\n" % roundtrips)
@@ -3265,7 +3292,7 @@
return len(self.getvalue())
def read(self, size=None):
- obsexcprg(self.ui, self.tell(), unit="bytes", total=self.length)
+ obsexcprg(self.ui, self.tell(), unit=_("bytes"), total=self.length)
return StringIO.read(self, size)
def __iter__(self):
@@ -3317,11 +3344,11 @@
% (len(markers), len(remotedata), totalbytes),
True)
for key, data in remotedata:
- obsexcprg(repo.ui, sentbytes, item=key, unit="bytes",
+ obsexcprg(repo.ui, sentbytes, item=key, unit=_("bytes"),
total=totalbytes)
rslts.append(remote.pushkey('obsolete', key, '', data))
sentbytes += len(data)
- obsexcprg(repo.ui, sentbytes, item=key, unit="bytes",
+ obsexcprg(repo.ui, sentbytes, item=key, unit=_("bytes"),
total=totalbytes)
obsexcprg(repo.ui, None)
if [r for r in rslts if not r]:
@@ -3530,12 +3557,12 @@
current = 0
data = StringIO()
ui = self.ui
- obsexcprg(ui, current, unit="bytes", total=length)
+ obsexcprg(ui, current, unit=_("bytes"), total=length)
while current < length:
readsize = min(length - current, chunk)
data.write(f.read(readsize))
current += readsize
- obsexcprg(ui, current, unit="bytes", total=length)
+ obsexcprg(ui, current, unit=_("bytes"), total=length)
obsexcprg(ui, None)
data.seek(0)
return data
@@ -3834,6 +3861,14 @@
bmdeactivate(repo)
if keepbranch:
repo.dirstate.setbranch(orig.branch())
+ if util.safehasattr(repo, 'currenttopic'):
+ # uurrgs
+ # there no other topic setter yet
+ if not orig.topic() and repo.vfs.exists('topic'):
+ repo.vfs.unlink('topic')
+ else:
+ with repo.vfs.open('topic', 'w') as f:
+ f.write(orig.topic())
try:
r = merge.graft(repo, orig, pctx, ['local', 'graft'], True)
--- a/tests/test-corrupt.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-corrupt.t Fri Mar 18 23:49:32 2016 -0700
@@ -101,7 +101,7 @@
summary: add A
- $ hg kill --fold -n -1 -- -2 -3
+ $ hg prune --fold -n -1 -- -2 -3
2 changesets pruned
$ hg push ../other
pushing to ../other
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-topic.t Fri Mar 18 23:49:32 2016 -0700
@@ -0,0 +1,223 @@
+
+Check we can find the topic extensions
+
+ $ [ -e $TOPICROOT/hgext3rd/topic/__init__.py ] || exit 80
+ $ cat >> $HGRCPATH <<EOF
+ > [defaults]
+ > amend=-d "0 0"
+ > fold=-d "0 0"
+ > [phases]
+ > publish = False
+ > [ui]
+ > logtemplate = {rev} - \{{get(namespaces, "topics")}} {node|short} {desc} ({phase})\n
+ > [diff]
+ > git = 1
+ > unified = 0
+ > [extensions]
+ > rebase =
+ > topic = $TOPICROOT/hgext3rd/topic/
+ > EOF
+ $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+
+ $ mkcommit() {
+ > echo "$1" > "$1"
+ > hg add "$1"
+ > hg ci -m "add $1"
+ > }
+
+Create a simple setup
+
+ $ hg init repoa
+ $ cd repoa
+ $ mkcommit aaa
+ $ mkcommit bbb
+ $ hg topic foo
+ $ mkcommit ccc
+ $ mkcommit ddd
+ created new head
+ $ mkcommit eee
+ created new head
+ $ mkcommit fff
+ created new head
+ $ hg topic bar
+ $ mkcommit ggg
+ created new head
+ $ mkcommit hhh
+ created new head
+ $ mkcommit iii
+ created new head
+ $ mkcommit jjj
+ created new head
+
+ $ hg log -G
+ @ 9 - {bar} 1d964213b023 add jjj (draft)
+ |
+ o 8 - {bar} fcab990f3261 add iii (draft)
+ |
+ o 7 - {bar} b0c2554835ac add hhh (draft)
+ |
+ o 6 - {bar} c748293f1c1a add ggg (draft)
+ |
+ o 5 - {foo} 6a6b7365c751 add fff (draft)
+ |
+ o 4 - {foo} 3969ab847d9c add eee (draft)
+ |
+ o 3 - {foo} 4e3a154f38c7 add ddd (draft)
+ |
+ o 2 - {foo} cced9bac76e3 add ccc (draft)
+ |
+ o 1 - {} a4dbed0837ea add bbb (draft)
+ |
+ o 0 - {} 199cc73e9a0b add aaa (draft)
+
+
+Test that evolve --all evolve the current topic
+-----------------------------------------------
+
+make a mess
+
+ $ hg up foo
+ switching to topic foo
+ 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+ $ hg topic -l
+ _ add bbb
+ t0: add ccc
+ t1: add ddd
+ t2: add eee
+ t3@ add fff (current)
+ $ hg up 'desc(ddd)'
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ echo ddd >> ddd
+ $ hg amend
+ 6 new unstable changesets
+ $ hg up 'desc(fff)'
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo fff >> fff
+ $ hg amend
+
+ $ hg log -G
+ @ 13 - {foo} e104f49bab28 add fff (draft)
+ |
+ | o 11 - {foo} d9cacd156ffc add ddd (draft)
+ | |
+ | | o 9 - {bar} 1d964213b023 add jjj (draft)
+ | | |
+ | | o 8 - {bar} fcab990f3261 add iii (draft)
+ | | |
+ | | o 7 - {bar} b0c2554835ac add hhh (draft)
+ | | |
+ | | o 6 - {bar} c748293f1c1a add ggg (draft)
+ | | |
+ +---x 5 - {foo} 6a6b7365c751 add fff (draft)
+ | |
+ o | 4 - {foo} 3969ab847d9c add eee (draft)
+ | |
+ x | 3 - {foo} 4e3a154f38c7 add ddd (draft)
+ |/
+ o 2 - {foo} cced9bac76e3 add ccc (draft)
+ |
+ o 1 - {} a4dbed0837ea add bbb (draft)
+ |
+ o 0 - {} 199cc73e9a0b add aaa (draft)
+
+
+Run evolve --all
+
+ $ hg evolve --all
+ move:[4] add eee
+ atop:[11] add ddd
+ move:[13] add fff
+ atop:[14] add eee
+ working directory is now at 070c5573d8f9
+ $ hg log -G
+ @ 15 - {foo} 070c5573d8f9 add fff (draft)
+ |
+ o 14 - {foo} 42b49017ff90 add eee (draft)
+ |
+ o 11 - {foo} d9cacd156ffc add ddd (draft)
+ |
+ | o 9 - {bar} 1d964213b023 add jjj (draft)
+ | |
+ | o 8 - {bar} fcab990f3261 add iii (draft)
+ | |
+ | o 7 - {bar} b0c2554835ac add hhh (draft)
+ | |
+ | o 6 - {bar} c748293f1c1a add ggg (draft)
+ | |
+ | x 5 - {foo} 6a6b7365c751 add fff (draft)
+ | |
+ | x 4 - {foo} 3969ab847d9c add eee (draft)
+ | |
+ | x 3 - {foo} 4e3a154f38c7 add ddd (draft)
+ |/
+ o 2 - {foo} cced9bac76e3 add ccc (draft)
+ |
+ o 1 - {} a4dbed0837ea add bbb (draft)
+ |
+ o 0 - {} 199cc73e9a0b add aaa (draft)
+
+
+Test that evolve does not loose topic information
+-------------------------------------------------
+
+ $ hg evolve --rev 'topic(bar)'
+ move:[6] add ggg
+ atop:[15] add fff
+ move:[7] add hhh
+ atop:[16] add ggg
+ move:[8] add iii
+ atop:[17] add hhh
+ move:[9] add jjj
+ atop:[18] add iii
+ working directory is now at 9bf430c106b7
+ $ hg log -G
+ @ 19 - {bar} 9bf430c106b7 add jjj (draft)
+ |
+ o 18 - {bar} d2dc89c57700 add iii (draft)
+ |
+ o 17 - {bar} 20bc4d02aa62 add hhh (draft)
+ |
+ o 16 - {bar} 16d6f664b17c add ggg (draft)
+ |
+ o 15 - {foo} 070c5573d8f9 add fff (draft)
+ |
+ o 14 - {foo} 42b49017ff90 add eee (draft)
+ |
+ o 11 - {foo} d9cacd156ffc add ddd (draft)
+ |
+ o 2 - {foo} cced9bac76e3 add ccc (draft)
+ |
+ o 1 - {} a4dbed0837ea add bbb (draft)
+ |
+ o 0 - {} 199cc73e9a0b add aaa (draft)
+
+
+Tests next and prev behavior
+============================
+
+Basic move are restricted to the current topic
+
+ $ hg up foo
+ switching to topic foo
+ 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+ $ hg prev
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ [14] add eee
+ $ hg next
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ [15] add fff
+ $ hg next
+ no children on topic "foo"
+ do you want --no-topic
+ [1]
+ $ hg next --no-topic
+ switching to topic bar
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ [16] add ggg
+ $ hg prev
+ no parent in topic "bar"
+ (do you want --no-topic)
+ $ hg prev --no-topic
+ switching to topic foo
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ [15] add fff
--- a/tests/test-evolve.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-evolve.t Fri Mar 18 23:49:32 2016 -0700
@@ -112,7 +112,7 @@
$ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
1 public stable
- $ hg kill 1
+ $ hg prune 1
abort: cannot prune immutable changeset: 7c3bad9141dc
(see "hg help phases" for details)
[255]
@@ -123,7 +123,7 @@
$ hg id -n
5
- $ hg kill .
+ $ hg prune .
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
working directory now at fbb94e3a0ecf
1 changesets pruned
@@ -136,7 +136,7 @@
test multiple kill
- $ hg kill 4 -r 3
+ $ hg prune 4 -r 3
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
working directory now at 7c3bad9141dc
2 changesets pruned
@@ -151,7 +151,7 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo 4 > g
$ hg add g
- $ hg kill .
+ $ hg prune .
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
working directory now at 7c3bad9141dc
1 changesets pruned
@@ -790,7 +790,7 @@
adding b
$ hg mv a c
$ hg ci -m c
- $ hg kill .^
+ $ hg prune .^
1 changesets pruned
1 new unstable changesets
$ hg stab --any
--- a/tests/test-inhibit.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-inhibit.t Fri Mar 18 23:49:32 2016 -0700
@@ -419,7 +419,7 @@
abort: hidden revision '3'!
(use --hidden to access hidden revisions)
[255]
- $ hg rebase -r ad78ff7d621f -r 53a94305e133 -d 2db36d8066ff
+ $ hg rebase -r ad78ff7d621f -r 53a94305e133 -d 2db36d8066ff --config experimental.rebaseskipobsolete=0
Warning: accessing hidden changesets 2db36d8066ff for write operation
Warning: accessing hidden changesets ad78ff7d621f,53a94305e133 for write operation
rebasing 10:ad78ff7d621f "add cK"
--- a/tests/test-obsolete-push.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-obsolete-push.t Fri Mar 18 23:49:32 2016 -0700
@@ -25,7 +25,7 @@
$ echo c > c
$ hg ci -qAm C c
$ hg phase --secret --force .
- $ hg kill 0 1
+ $ hg prune 0 1
2 changesets pruned
1 new unstable changesets
$ glog --hidden
--- a/tests/test-obsolete.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-obsolete.t Fri Mar 18 23:49:32 2016 -0700
@@ -457,6 +457,7 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg up
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 1 other heads for branch "default"
$ hg id -n
8
@@ -508,7 +509,7 @@
should not rebase extinct changesets
#excluded 'whole rebase set is extinct and ignored.' message not in core
- $ hg rebase -b '3' -d 4 --traceback
+ $ hg rebase -b '3' -d 4 --traceback --config experimental.rebaseskipobsolete=0
rebasing 3:0d3f46688ccc "add obsol_c"
rebasing 8:159dfc9fa5d3 "add obsol_d''" (tip)
2 new divergent changesets
--- a/tests/test-sharing.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-sharing.t Fri Mar 18 23:49:32 2016 -0700
@@ -89,6 +89,7 @@
added 1 changesets with 1 changes to 1 files (+1 heads)
2 new obsolescence markers
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 1 other heads for branch "default"
Figure SG03
$ hg shortlog --hidden -G
@@ -119,6 +120,7 @@
$ cd ../test-repo
$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 1 other heads for branch "default"
$ hg shortlog --hidden -G
@ 4:de6151c48e1c draft fix bug 37
|
--- a/tests/test-stabilize-result.t Thu Mar 17 17:03:51 2016 -0700
+++ b/tests/test-stabilize-result.t Fri Mar 18 23:49:32 2016 -0700
@@ -366,6 +366,6 @@
/!\ * hg up to the parent of the amended changeset (which are named W and Z)
/!\ * hg revert --all -r X
/!\ * hg ci -m "same message as the amended changeset" => new cset Y
- /!\ * hg kill -n Y W Z
+ /!\ * hg prune -n Y W Z
)
[255]