what is the most convient way to access files in different branches

Becker, Mischa J mischa.becker at kroger.com
Thu Jan 27 18:01:10 UTC 2022


> From: Uwe Brauer
> Sent: Wednesday, January 26, 2022 11:04 PM
> Subject: Re: what is the most convient way to access files in different branches
>
> > I use TortoiseHg's Save at Revision which appends @[rev] to the
> > filename. Saving foo.txt at revision 123 essentially does this:
>
> >     hg cat --decode -o "foo at 123.txt" -r 123 foo.txt
>
> Thanks. A long time ago I gave Tortoise a try and found it to complicated,
> so I stick to the command line and GNU emacs. Emacs has a similar
> function, that  works nicely, however only if the file exists in both
> branches, which is not my case.
>
> I have separated the files of these branches in different directories (a
> subversion approach, I know, but it avoids confusion). So I have to type
> on the command line
>
>  hg cat --decode -o "some-file-vs.tex" -r 123  directory/long-file-that-
> is-hard-to-remember.tex
>
> Which is cumbersome
>
> > That's the only time any of my files have "@" in their name so it's
> > obvious which files are references and which revision they are from. I
> > don't have whatever extension gives hg purge but it's easy enough to
> > del *@*.* if I don't want them anymore. Sometimes I'll add a line to
> > .hgignore to hide them.
>
> Emacs uses ~ I prefer a suffix vs-revnumber
>
> I have heard the share extension might be helpful, but I cannot really
> think how.

The other way I handle it when I have branches that have separate files in them is to have multiple copies of the repo, which was one of the other options you mentioned.

The first time I had multiple copies of the repo was when I was working with someone who wasn't willing to use a repository themselves. So I had a main project folder named DisplayPlan then inside that I had three repos, dp-admin, dp-rpt, & dp-zall. Repo dp-admin and dp-rpt had tip of their respective admin & report branches plus all ancestors. Repo dp-zall had everything. My code changes mostly happened in the 1st two repos while merging between branches and committing the changes from the other person happened in dp-zall.

A simpler approach would be to have only 2 copies of your repository, repo & repo-ref. Do all your work in repo while repo-ref only exists to pull changes from repo and to be updated to the other branch for reference. Repo-ref could even have an untracked macro or batch file to add\remove vs-revnumber to\from file names for you if you still need that.

Mischa

________________________________

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.



More information about the Mercurial mailing list