[PATCH 2 of 2] revert: save backup of undeleted files (issue3422)

Kevin Bullock kbullock+mercurial at ringworld.org
Fri May 4 10:26:20 CDT 2012


On May 4, 2012, at 10:16 AM, Kevin Bullock wrote:

> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1336141869 18000
> # Branch stable
> # Node ID a5119c4fa009c415ad398d84bc89669aa3ca1f80
> # Parent  e19cb9f091f89a90afffcc57935b86aac0689437
> revert: save backup of undeleted files (issue3422)
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1528,7 +1528,7 @@ def revert(ui, repo, ctx, parents, *pats
>             #   make backup if not in target manifest
>             (modified, revert, remove, True, True),
>             (added, revert, remove, True, False),
> -            (removed, undelete, None, False, False),
> +            (removed, undelete, None, True, False),

Note that this now creates .orig files on undelete even if the forgotten file in the working dir is unchanged from the version being reverted to. This is less than ideal, but I couldn't quite figure out how to check if the file was changed. repo.dirstate and repo.status are of no help here, because they both simply report the file as 'R' (removed). Anyone have ideas on this?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120504/d5472b1a/attachment.html>


More information about the Mercurial-devel mailing list