Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

version control - Workflow to keep Mercurial subrepositories up to date when changes are made in clones?

I have read every question on Mercurial subrepositories that I could and still not sure how it works. We are using hgweb.cgi on IIS so we have http:// paths to all of our repos.

Here is the basic layout:

/Libraries - http://server/Libraries
/Project1 - http://server/Project1
/Project1/LibrariesSubrepo - http://server/Project1/LibrariesSubrepo (clone of libraries)
/Project2 - http://server/Project1
/Project2/LibrariesSubrepo - http://server/Project2/LibrariesSubrepo (clone of libraries)

In the .hgsub files, I have the path setup as:

LibrariesSubrepo = LibrariesSubrepo

If I want to work on the projects, I clone them from the server to my workstation so I have a clone of Project1 and Project2 and it automatically pulls the subrepos as well.

In project1 on my local workstation, I make some changes to files in the /Project1/LibrariesSubrepo. How do I ensure that those changes make it back to the source repo for Libraries on the server? Do I have to manually push the changes from the subrepo to the source repo of the subrepo ?

I would like to be able to make changes in the Project1 repo locally, then commit/push those changes, then in Project2, I should be able to pull the changes from the server which should update the Project2/LibrariesSubrepo to the latest version.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can definitely push manually from your LibrariesSubrepo in Project1 to the Libraries repository on the server and then manually pull from Libraries into LibrariesSubrepo in a Project2 clone.

However, you can also link the subrepos on the server:

  1. The share extension lets you create two or more repositories that share a .hg folder. Do this on the server so that the three instances of the subrepo on the server share the .hg folders.

  2. Symlink the .hg folders -- more oldschol and it only works if you're on a server where you can create symlink (Unix servers or Windows Vista and later with the right priviledge).

  3. Keep just one subrepo on the server but expose it three times in the hgweb configuration. Like this:

    [paths]
    Project1                  = /repos/Project1
    Project1/LibrariesSubrepo = /repos/Libraries
    Project2                  = /repos/Project2
    Project2/LibrariesSubrepo = /repos/Libraries
    

In all cases, there are actually only three repositories on the server: Project1, Project2, and Libraries.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...