[PATCH 2 of 5 main-line-of-work (12 more to go)] addbackup: handle file in subdirectory

Matt Mackall mpm at selenic.com
Fri Nov 14 15:43:41 CST 2014


On Fri, 2014-11-14 at 18:58 +0000, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1415924063 0
> #      Fri Nov 14 00:14:23 2014 +0000
> # Node ID c2cab5ae84793c412e33db75ce41c030a4f5cedc
> # Parent  ff306c25475d36509de0d0ab8802a9b7d5967d87
> addbackup: handle file in subdirectory
> 
> The current naming scheme ('journal.backups.<file>') resulted is bad directory
> name when 'file' was in a subdirectory. We now extract the directory name and
> create the backupfile within it.
> 
> We plan to use file in a subdirectory for cachefile.
> 
> diff --git a/mercurial/transaction.py b/mercurial/transaction.py
> --- a/mercurial/transaction.py
> +++ b/mercurial/transaction.py
> @@ -10,10 +10,11 @@
>  #
>  # This software may be used and distributed according to the terms of the
>  # GNU General Public License version 2 or any later version.
>  
>  from i18n import _
> +import os
>  import errno
>  import error, util
>  
>  version = 2
>  
> @@ -201,11 +202,14 @@ class transaction(object):
>              msg = 'cannot use transaction.addbackup inside "group"'
>              raise RuntimeError(msg)
>  
>          if file in self.map or file in self._backupmap:
>              return
> -        backupfile = "%s.backup.%s" % (self.journal, file)
> +        dirname, filename = os.path.split(file)

vfs.join??

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list