Skip to content

Extraction of VCS revisions in sub-directories #43

Closed
@larskuhtz

Description

@larskuhtz

The generated PkgInfo modules check for the revision control system with the following code.

getVCS :: IO (Maybe RepoType)
getVCS =
    doesDirectoryExist ".hg" >>= \x0 -> if x0
    then return (Just Mercurial)
    else doesDirectoryExist ".git" >>= \x1 -> return $ if x1
        then Just Git
        else Nothing

This code only works correctly if called in the root directory of the repository. It's a common practice to develop more than one cabal package in a single repository by placing each package in a sub-directory. For that we must support detection of the VCS in sub-directories.

getVCS :: IO (Maybe RepoType)
getVCS =
    doesDirectoryExist ".hg" >>= \x0 -> if x0
    then return (Just Mercurial)
    else doesDirectoryExist ".git" >>= \x1 -> return $ if x1
        then Just Git
        else Nothing {- TODO if pwd is not call getVCS on ".." -}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions