Question

In the answer to this question on the kiln stack exchange site, there is a comment that mentions "if you commit from one consumer of the library, the other library consumers do not immediately see those changesets. You have to explicitly pull the changes on the library repo in other consumers."

i have added a few files to a repository which is referred to in a projects .hgsub & .hgsubstate files, but they are not showing up in the projects subrespository (because the project is quite rightly using the previous change-set it was earlier assigned)

I'd like to know how to edit which changeset a subrepo uses. do I just edit the .hgsubstate file (seems a little "hackish") or is there a command / kiln website option I can use?

Was it helpful?

Solution

In the subrepository, hg update to the changeset you want the main repository to use. Then, in the main repository, issue hg ci to commit the subrepository change. Mercurial will automatically update the .hgsubstate file with the current parent changeset ID of the subrepository.

Example (Windows .bat file):

REM Create main repository
hg init Example
cd Example
echo >file1
hg ci -Am file1
cd ..

REM Create another repository
hg init Library
cd Library
echo >file2
hg ci -Am file2
cd ..

REM Clone the Library into the main repository
cd Example
hg clone ..\Library

REM and configure it as a subrepository.
echo Library=Library >.hgsub

REM Commit it.
hg ci -Am "Added Library sub repository."

REM Note .hgsubstate is updated with the current subrepo changeset.
type .hgsubstate
cd ..

REM Someone updates the original Library.
cd Library
echo >file3
hg ci -Am file3
cd ..

REM Main repo isn't affected.  It has a clone of Library.
cd Example
hg status -S

REM Update to the latest library
cd Library
hg pull -u
cd ..

REM View the changes to the library in the main repo.
hg status -S

REM Commit the library update in the main repo.
hg ci -m "Updated library."

REM Note .hgsubstate is updated.
type .hgsubstate
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top