All pastes #1899884 Raw Edit

nicdumz

public text v1 · immutable
#1899884 ·published 2010-07-13 16:22 UTC
rendered paste body
# HG changeset patch# User Nicolas Dumazet <nicdumz.commits@gmail.com># Date 1279038138 -32400# Branch stable# Node ID ee06978dcb641f24bb9667430978169dd96d431c# Parent  134eb1c97e94beb833de5822f2a5f74c4e6e2863mq: clarify qimport error messages* when hitting "hg qimport <tag|branch|revspec>" by mistake, it is confusing  to receive a "unable to read tip" kind of error message. Clarify that  qimport is looking for a _file_* help user, explain him why he could be wrong. Use case:1 - 6 - 7 - 8 - 9/tip \   2 - 3 - 4 - @5/stableUser wants to edit stable and hits "hg qimport -r2:tip" instead of r2:stableby mistake. Previous error message was:  "revision 6 has unmanaged children"and the user would wonder "why is mq looking at the default branch? can't itimport patches when there are several heads?" instead of noticing hisrevspec mistake.On the other hand,  "cannot import revision 6: it has unmanaged children"explicitely warns that mq tried to _import_ rev6, hinting at a command-lineerror.diff --git a/hgext/mq.py b/hgext/mq.py--- a/hgext/mq.py+++ b/hgext/mq.py@@ -1634,21 +1634,22 @@             # Otherwise, they should form a linear path to a head.             heads = repo.changelog.heads(repo.changelog.node(rev[-1]))             if len(heads) > 1:-                raise util.Abort(_('revision %d is the root of more than one '-                                   'branch') % rev[-1])+                raise util.Abort(_('cannot import revision %d: it is the root '+                                   'of more than one branch') % rev[-1])             if self.applied:                 base = repo.changelog.node(rev[0])                 if base in [n.node for n in self.applied]:-                    raise util.Abort(_('revision %d is already managed')-                                     % rev[0])+                    raise util.Abort(_('cannot import revision %d: it is '+                                       'already managed') % rev[0])                 if heads != [self.applied[-1].node]:-                    raise util.Abort(_('revision %d is not the parent of '-                                       'the queue') % rev[0])+                    raise util.Abort(_('cannot import revision %d: it is not '+                                       'the parent of the queue') % rev[0])                 base = repo.changelog.rev(self.applied[0].node)                 lastparent = repo.changelog.parentrevs(base)[0]             else:                 if heads != [repo.changelog.node(rev[0])]:-                    raise util.Abort(_('revision %d has unmanaged children')+                    raise util.Abort(_('cannot import revision %d: it has '+                                       'unmanaged children')                                      % rev[0])                 lastparent = None @@ -1659,8 +1660,8 @@                 if p2 != nullrev:                     raise util.Abort(_('cannot import merge revision %d') % r)                 if lastparent and lastparent != r:-                    raise util.Abort(_('revision %d is not the parent of %d')-                                     % (r, lastparent))+                    raise util.Abort(_('cannot import revision %d: it is not '+                                       'the parent of %d') % (r, lastparent))                 lastparent = p1                  if not patchname:@@ -1702,7 +1703,7 @@                     else:                         text = url.open(self.ui, filename).read()                 except (OSError, IOError):-                    raise util.Abort(_("unable to read %s") % filename)+                    raise util.Abort(_("unable to read file %s") % filename)                 if not patchname:                     patchname = normname(os.path.basename(filename))                 self.check_reserved_name(patchname)diff --git a/tests/test-mq-qimport-fail-cleanup.out b/tests/test-mq-qimport-fail-cleanup.out--- a/tests/test-mq-qimport-fail-cleanup.out+++ b/tests/test-mq-qimport-fail-cleanup.out@@ -4,7 +4,7 @@  #qimport valid patch followed by invalid patch adding b.patch to series file-abort: unable to read fakepatch+abort: unable to read file fakepatch  #valid patches before fail added to series b.patchdiff --git a/tests/test-mq-qimport.out b/tests/test-mq-qimport.out--- a/tests/test-mq-qimport.out+++ b/tests/test-mq-qimport.out@@ -1,5 +1,5 @@ % qimport non-existing-file-abort: unable to read non-existing-file+abort: unable to read file non-existing-file % import email adding email to series file applying email