Mercurial > hg
comparison mercurial/subrepo.py @ 18936:1fa4edb8456e
subrepo: introduce storeclean helper functions
These helper functions are currently unused but will be used to implement the
cleanstore method that will be introduced later.
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Sat, 16 Feb 2013 00:07:00 +0100 |
parents | a60963c02f92 |
children | 9a171baa9202 |
comparison
equal
deleted
inserted
replaced
18935:e5d9441ec281 | 18936:1fa4edb8456e |
---|---|
11 import config, scmutil, util, node, error, cmdutil, bookmarks, match as matchmod | 11 import config, scmutil, util, node, error, cmdutil, bookmarks, match as matchmod |
12 hg = None | 12 hg = None |
13 propertycache = util.propertycache | 13 propertycache = util.propertycache |
14 | 14 |
15 nullstate = ('', '', 'empty') | 15 nullstate = ('', '', 'empty') |
16 | |
17 | |
18 def _getstorehashcachename(remotepath): | |
19 '''get a unique filename for the store hash cache of a remote repository''' | |
20 return util.sha1(remotepath).hexdigest()[0:12] | |
21 | |
22 def _calcfilehash(filename): | |
23 data = '' | |
24 if os.path.exists(filename): | |
25 fd = open(filename) | |
26 data = fd.read() | |
27 fd.close() | |
28 return util.sha1(data).hexdigest() | |
16 | 29 |
17 class SubrepoAbort(error.Abort): | 30 class SubrepoAbort(error.Abort): |
18 """Exception class used to avoid handling a subrepo error more than once""" | 31 """Exception class used to avoid handling a subrepo error more than once""" |
19 def __init__(self, *args, **kw): | 32 def __init__(self, *args, **kw): |
20 error.Abort.__init__(self, *args, **kw) | 33 error.Abort.__init__(self, *args, **kw) |