[PATCH 5 of 5] histedit: choose only outgoing ancestors of the working directory always
Augie Fackler
raf at durin42.com
Mon Aug 26 08:50:19 CDT 2013
On Mon, Aug 26, 2013 at 04:41:52PM +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1377501081 -32400
> # Mon Aug 26 16:11:21 2013 +0900
> # Node ID 194e5b271e3f46f1fd6d6b31494c450aef873f2b
> # Parent 530564f737e2bf5111f769f944f6d0f7b6942def
> histedit: choose only outgoing ancestors of the working directory always
I think I'd reword this entire commit message in terms of revsets:
"""
Prior to this patch, --outgoing was equivalent to `outgoing()`, which
might have revisions that are not an ancestor of the working copy. Now
--outgoing is equivalent to `outgoing() and ::.`, which ensures that
all selected revisions will be an ancestor of the working copy.
"""
>
> Before this patch, when there are two or more "root" revisions in
> outgoing ones, "histedit --outgoing" only succeeds when working
> directory is a descendant of the oldest root. It seems to be ambiguous
> and difficult for users.
>
> This patch makes "histedit --outgoing" choose only outgoing ancestors
> of the working directory always.
>
> This patch also compares between branch names of working directory and
> the destination URL, for sensitivity to branch in the destination URL.
> This comparison also omits useless looking up.
Huh? I have literally no idea what named branches have to do with anything here.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -411,14 +411,15 @@
> Used by initialisation code"""
> dest = ui.expandpath(remote or 'default-push', remote or 'default')
> dest, revs = hg.parseurl(dest, None)[:2]
> + if revs[0] and repo.dirstate.branch() != revs[0]:
> + msg = _('no outgoing ancestors')
> + hint = _('branch "%s" is specified in the destination URL') % revs[0]
> + raise util.Abort(msg, hint=hint)
> ui.status(_('comparing with %s\n') % util.hidepassword(dest))
>
> - revs, checkout = hg.addbranchrevs(repo, repo, revs, None)
> + revs = repo.dirstate.parents()[:1]
> other = hg.peer(repo, opts, dest)
>
> - if revs:
> - revs = [repo.lookup(rev) for rev in revs]
> -
> outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force)
> if not outgoing.missing:
> raise util.Abort(_('no outgoing ancestors'))
> @@ -457,6 +458,9 @@
> With --outgoing, this edits changesets not found in the
> destination repository. If URL of the destination is omitted, the
> 'default-push' (or 'default') path will be used.
> +
> + This command edits only outgoing ancestors of the working
> + directory.
> """
> # TODO only abort if we try and histedit mq patches, not just
> # blanket if mq patches are applied somewhere
> diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t
> --- a/tests/test-histedit-outgoing.t
> +++ b/tests/test-histedit-outgoing.t
> @@ -102,4 +102,34 @@
> # m, mess = edit message without changing commit content
> #
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> + $ HGEDITOR=cat hg histedit --outgoing '../r#default' | grep -v comparing | grep -v searching | grep -v '^#'
> + abort: no outgoing ancestors
> + (branch "default" is specified in the destination URL)
> + [1]
> +
> +test to edit only outgoing ancestors of the working directory
> +
> + $ HGEDITOR=cat hg histedit --outgoing '../r' | grep -v comparing | grep -v searching | grep -v '^#'
> + pick f26599ee3441 6 create foo branch
> +
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> + $ hg -q update -C 2
> + $ echo aa >> a
> + $ hg -q commit -m 'another head on default'
> +
> + $ HGEDITOR=cat hg histedit --outgoing '../r' | grep -v comparing | grep -v searching | grep -v '^#'
> + pick 3879dc049647 7 another head on default
> +
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> + $ hg -q update -C 5
> + $ HGEDITOR=cat hg histedit --outgoing '../r' | grep -v comparing | grep -v searching | grep -v '^#'
> + pick 055a42cdd887 3 d
> + pick e860deea161a 4 e
> + pick 652413bf663e 5 f
> +
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list