I’ve started using version control to better manage revisions to my PowerShell code. I decided to use Mercurial for 3 main reasons:
- As a DVCS, it doesn’t require a server.
- If I want to, I can store a private repository online for free (bitbucket.org)
- It seemed simpler to use than Git.
Mercurial works well for versioning PowerShell Modules since each module is contained in its own directory. However, I have some scripts that don’t belong in a module, but I would still like to version them. These scripts are in a “.\Scripts” directory that is added to
$env:PATH so I can easily run them from the command line. Since these scripts aren’t really related to each other, it doesn’t make much sense to create a single repository for the Scripts directory.
How should I version single scripts?
I’ve thought of the following options:
- Create subdirectory for each script/related scripts.
- Use temporary repositories until the script is “stable” then add the script to the main “Scripts” directory and version the collection of scripts as one. This would reduce the number of changesets introduced to the “Scripts” repository.
Is there a tool that better handles versioning single files? Is there better way for versioning single files with Mercurial? Any other ideas?
Grouping of files based on their functionality should be based on
2) Folder they are in.
Just give a proper name for the scripts. If there are multiple related scripts group them into a folder. Having one script per folder makes no sense. You end up with almost same number of folders as scripts.
All this in a single repository. Generally, people have multiple projects in a single repo. Creating multiple repos, especially for a few files means lots of overhead. If the script is not “stable” use branches. That is what they are for and merge them back.
And don’t worry how many “changesets” are there in the repo!
PS: Might seem a bit opinionated, but there is no real right or wrong answer for what you ask.