Submitter | Olle Lundberg |
---|---|
Date | March 5, 2014, 4:21 p.m. |
Message ID | <1856c7395b2b4e748719.1394036510@SE-C02KQ0DADR55> |
Download | mbox | patch |
Permalink | /patch/3863/ |
State | Changes Requested |
Headers | show |
Comments
Olle Lundberg <olle.lundberg@gmail.com> writes: > > +def execute(ui, repo, ctx, cmd, opts): > + hg.update(repo, ctx.node()) > + rc = util.system(cmd) I think it would be nice to populate a HGREVISION and HGNODE environment variable at this point.
On Wed, Mar 5, 2014 at 7:00 PM, David Soria Parra <dsp@experimentalworks.net > wrote: > Olle Lundberg <olle.lundberg@gmail.com> writes: > > > > +def execute(ui, repo, ctx, cmd, opts): > > + hg.update(repo, ctx.node()) > > + rc = util.system(cmd) > > I think it would be nice to populate a HGREVISION and HGNODE environment > variable at this point. > Ok. Will add that. The issue with running commands from within mercurial is that mercurial holds an exclusive lock over the whole repo. Which means that a tool can not do any commits of their own. They can just leave the wd in a dirty state and the user have to commit and --continue by herself. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel >
On Wed, Mar 5, 2014 at 7:56 PM, David Soria Parra <dsp@experimentalworks.net > wrote: > Olle <olle.lundberg@gmail.com> writes: > > > On Wed, Mar 5, 2014 at 7:00 PM, David Soria Parra > > <dsp@experimentalworks.net> wrote: > > > > Olle Lundberg <olle.lundberg@gmail.com> writes: > > > > > > +def execute(ui, repo, ctx, cmd, opts): > > > + hg.update(repo, ctx.node()) > > > + rc = util.system(cmd) > > > > > > I think it would be nice to populate a HGREVISION and HGNODE > > environment > > variable at this point. > > > > Ok. Will add that. > > > > The issue with running commands from within mercurial is that > > mercurial holds an exclusive lock over the whole repo. Which means > > that a tool can not do any commits of their own. They can just leave > > the wd in a dirty state and the user have to commit and --continue by > > herself. > > > > I think you want to drop locks before util.system and reaquire them > afterwards. Reaquiring locks will also properly invalidate dirstate > and manifest. > Re-sending your reply to the list.
Patch
diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -333,10 +333,23 @@ applychanges(ui, repo, oldctx, opts) raise error.InterventionRequired( _('Make changes as needed, you may commit or record as needed now.\n' 'When you are finished, run hg histedit --continue to resume.')) +def execute(ui, repo, ctx, cmd, opts): + hg.update(repo, ctx.node()) + rc = util.system(cmd) + if rc != 0: + raise error.InterventionRequired( + _('Command exited with %i. Fix up the change and run ' + 'hg histedit --continue') % rc) + if util.any(repo.status()[:4]): + raise error.InterventionRequired( + _('Working copy dirty, please check the files listed above.\n' + 'When you are finished, run hg histedit --continue to resume.')) + return ctx, [] + def fold(ui, repo, ctx, ha, opts): oldctx = repo[ha] hg.update(repo, ctx.node()) stats = applychanges(ui, repo, oldctx, opts) if stats and stats[3] > 0: