Mercurial > hg
changeset 2375:9f4f77693890
Added some comments
author | Marco Barisione <marco@barisione.org> |
---|---|
date | Tue, 16 May 2006 21:43:21 +0200 |
parents | ffc2ed61061b |
children | 52cfb9864257 |
files | purge.py |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/purge.py Tue May 16 21:05:00 2006 +0200 +++ b/purge.py Tue May 16 21:43:21 2006 +0200 @@ -83,12 +83,24 @@ except OSError, e: self._error('"%s" cannot be removed' % name) - def _relative_name(self, name): - splitted_path = self._split_path(name)[len(self._hg_root):] + def _relative_name(self, path): + ''' + Returns "path" but relative to the root directory of the + repository and with '\\' replaced with '/'. + This is needed because this is the format required by + self._repo.dirstate.state(). + ''' + splitted_path = self._split_path(path)[len(self._hg_root):] # Even on Windows self._repo.dirstate.state() wants '/'. return self._join_path(splitted_path).replace('\\', '/') def _split_path(self, path): + ''' + Retruns a list of the single files/directories in "path". + For instance: + '/home/user/test' -> ['/', 'home', 'user', 'test'] + 'C:\\Mercurial' -> ['C:\\', 'Mercurial'] + ''' ret = [] while True: head, tail = os.path.split(path) @@ -102,6 +114,9 @@ return ret def _join_path(self, splitted_path): + ''' + Joins a list returned by _split_path(). + ''' ret = '' for part in splitted_path: if ret: