[SoC] Rebase feature - Nested revisions

Christian Ebert blacktrash at gmx.net
Fri May 30 22:06:08 UTC 2008


* Javier Merino on Friday, May 30, 2008 at 19:15:35 +0200
> Hi, I think it would be nice if rebase refused to run if it found
> changes in the working directory. One of the first steps when rebasing
> is hg.clean(), so local changes are lost without even prompting the
> user! I think this patch fixes it.
> 
> # HG changeset patch
> # User Javier Merino <cibervicho at gmail.com>
> # Date 1212167652 -7200
> # Node ID f9061368a9ea0442fe65fd1085edbf6fac77801c
> # Parent  ae29cc0ed86a697187442673f5a54ea369b3064e
> Refuse to run if the working directory is not clean.
> 
> diff -r ae29cc0ed86a -r f9061368a9ea rebase.py
> --- a/rebase.py Fri May 30 18:00:56 2008 +0200
> +++ b/rebase.py Fri May 30 19:14:12 2008 +0200
> @@ -21,9 +21,15 @@
>         self.ui = ui
>         self.repo = repo
>         self.opts = opts
> +        self._checkwdclean()
>         self._checkheads()
>         self._definepoints()
>         self._rebase()
> +
> +    def _checkwdclean(self):
> +        m, a, r, d = self.repo.status()[:4]
> +        if m or a or r or d:
> +            raise util.Abort(_("local changes found"))
> 
>     def _checkheads(self):
>         numheads = len(self.repo.heads())

Depending on context, one could simply use
cmdutil.bail_if_changed instead.

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]

_F R E E_  _V I D E O S_  -->>  http://www.blacktrash.org/underdogma/



More information about the Mercurial-devel mailing list