Mercurial > hg > easyhg
diff common.h @ 79:aaeabc920ca8
* Some work toward doing the Right Thing with each possible combination of existing/nonexisting directories in Open dialog
author | Chris Cannam |
---|---|
date | Mon, 22 Nov 2010 12:30:40 +0000 |
parents | 07405f3a428b |
children | 1928f9b408e6 |
line wrap: on
line diff
--- a/common.h Mon Nov 22 10:03:15 2010 +0000 +++ b/common.h Mon Nov 22 12:30:40 2010 +0000 @@ -50,6 +50,34 @@ extern void loseControllingTerminal(); +/** + * Status used in testing whether a folder argument (received from the + * user) is valid for particular uses. + */ +enum FolderStatus { + FolderUnknown, /// Neither the folder nor its parent exists + FolderParentExists, /// The folder is absent, but its parent exists + FolderExists, /// The folder exists and has no .hg repo in it + FolderHasRepo, /// The folder exists and has an .hg repo in it + FolderIsFile /// The "folder" is actually a file +}; + +FolderStatus getFolderStatus(QString path); + +/** + * If the given path is somewhere within an existing repository, + * return the path of the root directory of the repository (i.e. the + * one with .hg in it). + * + * If the given path is _not_ in a repository, or the given path _is_ + * the root directory of a repository, return QString(). Use + * getFolderStatus to distinguish between these cases. + */ +QString getContainingRepoFolder(QString path); + +QString xmlEncode(QString); + + #endif //COMMON_H