[PATCH 5 of 5] reset mtime when two files are equal

Matt Mackall mpm at selenic.com
Thu Nov 10 21:23:49 UTC 2005


On Thu, Nov 10, 2005 at 11:03:19AM +0100, Benoit Boissinot wrote:
> # HG changeset patch
> # User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
> # Node ID c59a347097fffe3c7e97bc88312bd6535b17b6fc
> # Parent  c7be40168c4c58343d22e9f8276be8df49451aad
> reset mtime when two files are equal
> 
> diff -r c7be40168c4c -r c59a347097ff mercurial/localrepo.py
> --- a/mercurial/localrepo.py	Thu Nov 10 10:41:08 2005 +0100
> +++ b/mercurial/localrepo.py	Thu Nov 10 10:44:41 2005 +0100
> @@ -490,9 +490,14 @@
>                      # do a full compare of any files that might have changed
>                      change = self.changelog.read(self.dirstate.parents()[0])
>                      mf2 = mfmatches(change[0])
> +                    wlock = None
>                      for f in l:
>                          if fcmp(f, mf2):
>                              c.append(f)
> +                        else:
> +                            if wlock is None:
> +                                wlock = self.wlock()

At this point, we need to reread the dirstate because it may be out of
date.

It's probably best to just build up a list of mtimes to update and if
the list is non-empty at the end, grab the lock, reload, and do the
update.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list