In the good old days of Subversion, I would sometimes derive a new file from an existing one using svn copy
. Then if something changed in sections they had in common, I could still use svn merge
to update the derived version.
To use the example from hginit.com, say the "guac" recipe already exists, and I want to create a "superguac" that includes instructions on how to serve guacamole to 1000 raving soccer fans. Using the process I just described, I could:
svn cp guac superguac
svn ci -m "Created superguac by copying guac"
(edit superguac)
svn ci -m "Added instructions for serving 1000 raving soccer fans to superguac"
(edit guac)
svn ci -m "Fixed a typo in guac"
svn merge -r3:4 guac superguac
and thus the typo fix would be applied to superguac.
Mercurial provides an hg copy
command that marks a file as a copy of the original, but I'm not sure the repository structure supports a similar workflow. Here's the same example, and I carefully only edit a single file in the commit I want to use in the merge:
hg cp guac superguac
hg ci -m "Created superguac by copying guac"
(edit superguac)
hg ci -m "Added instructions for serving 1000 raving soccer fans to superguac"
(edit guac)
hg ci -m "Fixed a typo in guac"
I now want to apply the change in guac to superguac. Is that possible? If so, what's the right command? Is there a different workflow in Mercurial that achieves the same results (limited to a single branch)?