Mercurial > hg
changeset 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 | e5d9441ec281 |
children | 9a171baa9202 |
files | mercurial/subrepo.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Fri Feb 08 16:17:46 2013 -0600 +++ b/mercurial/subrepo.py Sat Feb 16 00:07:00 2013 +0100 @@ -14,6 +14,19 @@ nullstate = ('', '', 'empty') + +def _getstorehashcachename(remotepath): + '''get a unique filename for the store hash cache of a remote repository''' + return util.sha1(remotepath).hexdigest()[0:12] + +def _calcfilehash(filename): + data = '' + if os.path.exists(filename): + fd = open(filename) + data = fd.read() + fd.close() + return util.sha1(data).hexdigest() + class SubrepoAbort(error.Abort): """Exception class used to avoid handling a subrepo error more than once""" def __init__(self, *args, **kw):