Re: [PATCH 1/N] Document that CVSFile.get_filename() is normalised

Michael Haggerty <[email protected]> Fri, 02 Apr 2010 15:59:24 +0200
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Jon Foster wrote:
> The paths returned by CVSFile.get_filename() are already normalised,
> there's no need to pass them through os.path.normpath() again.
> I'm not happy relying on undocumented behaviour, so document this.

Is this always the case?  I think you are relying on

    os.path.join(os.path.normpath(a), os.path.normpath(b)) \
        == os.path.normpath(os.path.join(a, b))

but this is not necessarily the case, for example if a or b contain '.'
or '..'.  For example, I think that there is a problem if
project.project_cvs_repos_path=='.'.

I like the idea of guaranteeing that the output of get_filename() is
normalized, though.  What do you think about putting a call to
os.path.normpath() in your _calculate_filename() method and doing the
same for CVSDirectory?

You might also think about pulling up some common code (e.g., the
get_filename() method, the "filename" attribute, and the initialization
thereof) to CVSPath to avoid gratuitous differences between CVSDirectory
and CVSFile.  Of course the _calculate_filename() methods will have to
be defined in the derived classes.

Michael

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2468785

To unsubscribe from this discussion, e-mail: [[email protected]].