English 中文(简体)
suggestions for using PATH to executables with version control (Mercurial)
原标题:

So I m pretty new to version control but I m trying to use Mercurial on my Mac to keep a large Python data analysis program organized. I typically clone my main repository, tweak the clone s code a bit, and run the code on my data. If the changes were successful I commit and eventually push the changes back to my main repository. I guess that s a pretty typical workflow under version control.

My problem is that my code is run on the command-line, with several command-line arguments that refer to data files in the current working directory (and I have many such directories I need to test the code in, and they re outside of version control). So before using Mercurial I just kept my code in one ~/bin directory which was part of my PATH environment variable. Now, with version control, I need to either (1) after each edit, copy my current clone s executables to the ~/bin directory before running the code on the command line, or (2) each time I clone my code, add my current clone s path to the PATH, or (3) specify the entire/path/to/my/programs on the command line each time I run the code. None of these are very convenient, and I m left feeling like there must be an elegant solution that I just don t know. Maybe something involving Mercurial s hooks? I want my under-revision code to be runnable on the command line between commits, so this seemed to rule out hooks, but I don t know... Many thanks for any suggestions!

最佳回答

Ry4an s answer is good if you want to continue with the multiple-clones workflow. But it s also worth being aware that Mercurial s powerful enough to allow you most of the benefits of that workflow without ever leaving your single "main" repo. I.e. you can create branches (named or anonymous) for experimental features, easily "hg update" to whatever version of the code you want to test, even use the mq extension to prune branches that didn t work out.

问题回答

What I do in such a case is set up a two deep chain of symlinks to my binary in my current clone. For example I ll have:

/usr/bin/myappname

which is a symlink to

/home/me/repos/CURRENT/bin/myappname

where /home/me/repos/CURRENT is a symlink to whatever my current working clone is, for example:

/home/me/repos/myproject-expirment

After setting up the initial /usr/bin/myappname symlink all I have to do is update the CURRENT symlink when I create a new clone on which I m working.





相关问题
Can I clone part of a Mercurial repository?

Is it possible to clone part of a Mercurial repository? Let s say the repository is quite large, or contains multiple projects, or multiple branches. Can I clone only part of the repository? E.g. in ...

Sync files in Two Different Repos using HG

I ve got a problem when I try to sync files in two different repos. What I want to do is: I ve got 2 repos A and B, and they share some common files, suppose they lie in A/docs/common/ and B/docs/...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

git for mercurial like git-svn

Hello is there a tool for git that allow to work with mercurial repositories F.e. for svn there is a git-svn package, that allows to clone/commit/update from svn and work in a git way.. So is there ...

Useful Mercurial Hooks [closed]

What are some useful Mercurial hooks that you have come across? A few example hooks are located in the Mercurial book: acl bugzilla notify check for whitespace I personally don t find these very ...

热门标签