Submitter | Pierre-Yves David |
---|---|
Date | April 18, 2013, 2:14 p.m. |
Message ID | <faf243b081f1aa1b1413.1366294475@crater2.logilab.fr> |
Download | mbox | patch |
Permalink | /patch/1413/ |
State | Accepted, archived |
Headers | show |
Comments
On Thu, Apr 18, 2013 at 04:14:35PM +0200, pierre-yves.david@logilab.fr wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@logilab.fr> > # Date 1366293449 -7200 > # Thu Apr 18 15:57:29 2013 +0200 > # Node ID faf243b081f1aa1b141300158089ee978e64b618 > # Parent a87a4fc0a11c51fcf7ec7d67ddf4fec319217678 > histedit: handle multiple space between action and hash (issue3893) > > There is some clue that the previous code intended to handle that but it was > actually not the case. > > As a result action could apply to the empty string '' changeset. Leading to the > use the current working directory parent in come operation. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -720,14 +720,11 @@ def verifyrules(rules, repo, ctxs): > raise util.Abort(_('must specify a rule for each changeset once')) > for r in rules: > if ' ' not in r: > raise util.Abort(_('malformed line "%s"') % r) > action, rest = r.split(' ', 1) > - if ' ' in rest.strip(): > - ha, rest = rest.split(' ', 1) > - else: > - ha = r.strip() > + ha = rest.strip().split(' ', 1)[0] > try: > if repo[ha] not in ctxs: > raise util.Abort( > _('may not use changesets other than the ones listed')) > except error.RepoError: > diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t > --- a/tests/test-histedit-arguments.t > +++ b/tests/test-histedit-arguments.t > @@ -66,5 +66,38 @@ Run on a revision not ancestors of the c > $ hg up 2 > 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > $ hg histedit -r 4 > abort: 08d98a8350f3 is not an ancestor of working directory > [255] > + $ hg up --quiet > + > +Test short version of command > +--------------------------------------- > + > +Note: we use various number of white space between command name and changeset > +short hash. This test issue3893. > + > +So one is missing and one appear twice. Huh? I'm not sure what this sentence means - it looks like we've got all three changes, and they're just in order? > + > + $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF > + > pick eb57da33312f 2 three > + > p c8e68270e35a 3 four > + > f 08d98a8350f3 4 five > + > EOF > + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > + reverting alpha > + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > + four > + *** > + five > + > + > + > + HG: Enter commit message. Lines beginning with 'HG:' are removed. > + HG: Leave message empty to abort commit. > + HG: -- > + HG: user: test > + HG: branch 'default' > + HG: changed alpha > + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved > + saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob) Can we log some before and after here? I'm not following.
On Thu, Apr 18, 2013 at 11:00:58AM -0400, Augie Fackler wrote: > On Thu, Apr 18, 2013 at 04:14:35PM +0200, pierre-yves.david@logilab.fr wrote: > > # HG changeset patch > > # User Pierre-Yves David <pierre-yves.david@logilab.fr> > > # Date 1366293449 -7200 > > # Thu Apr 18 15:57:29 2013 +0200 > > # Node ID faf243b081f1aa1b141300158089ee978e64b618 > > # Parent a87a4fc0a11c51fcf7ec7d67ddf4fec319217678 > > histedit: handle multiple space between action and hash (issue3893) > > > > There is some clue that the previous code intended to handle that but it was > > actually not the case. > > > > As a result action could apply to the empty string '' changeset. Leading to the > > use the current working directory parent in come operation. > > > > diff --git a/hgext/histedit.py b/hgext/histedit.py > > --- a/hgext/histedit.py > > +++ b/hgext/histedit.py > > @@ -720,14 +720,11 @@ def verifyrules(rules, repo, ctxs): > > raise util.Abort(_('must specify a rule for each changeset once')) > > for r in rules: > > if ' ' not in r: > > raise util.Abort(_('malformed line "%s"') % r) > > action, rest = r.split(' ', 1) > > - if ' ' in rest.strip(): > > - ha, rest = rest.split(' ', 1) > > - else: > > - ha = r.strip() > > + ha = rest.strip().split(' ', 1)[0] > > try: > > if repo[ha] not in ctxs: > > raise util.Abort( > > _('may not use changesets other than the ones listed')) > > except error.RepoError: > > diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t > > --- a/tests/test-histedit-arguments.t > > +++ b/tests/test-histedit-arguments.t > > @@ -66,5 +66,38 @@ Run on a revision not ancestors of the c > > $ hg up 2 > > 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > > $ hg histedit -r 4 > > abort: 08d98a8350f3 is not an ancestor of working directory > > [255] > > + $ hg up --quiet > > + > > +Test short version of command > > +--------------------------------------- > > + > > +Note: we use various number of white space between command name and changeset > > +short hash. This test issue3893. > > + > > +So one is missing and one appear twice. > > Huh? I'm not sure what this sentence means - it looks like we've got > all three changes, and they're just in order? This sentence jumped from another patch adding another test!. it can be dropped. I'll put it back where is belong
Patch
diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -720,14 +720,11 @@ def verifyrules(rules, repo, ctxs): raise util.Abort(_('must specify a rule for each changeset once')) for r in rules: if ' ' not in r: raise util.Abort(_('malformed line "%s"') % r) action, rest = r.split(' ', 1) - if ' ' in rest.strip(): - ha, rest = rest.split(' ', 1) - else: - ha = r.strip() + ha = rest.strip().split(' ', 1)[0] try: if repo[ha] not in ctxs: raise util.Abort( _('may not use changesets other than the ones listed')) except error.RepoError: diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t --- a/tests/test-histedit-arguments.t +++ b/tests/test-histedit-arguments.t @@ -66,5 +66,38 @@ Run on a revision not ancestors of the c $ hg up 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg histedit -r 4 abort: 08d98a8350f3 is not an ancestor of working directory [255] + $ hg up --quiet + +Test short version of command +--------------------------------------- + +Note: we use various number of white space between command name and changeset +short hash. This test issue3893. + +So one is missing and one appear twice. + + $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF + > pick eb57da33312f 2 three + > p c8e68270e35a 3 four + > f 08d98a8350f3 4 five + > EOF + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + reverting alpha + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + four + *** + five + + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: changed alpha + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)