Regarding Mercurial Security + recursive checkins of subrepositories

596 views Asked by At

this is going to be a long post...sorry upfront.

I'm trying to wrap my head around how to hold together "Repositories for each project branch", and what the impact of that would be on a team.

Right now, it appears that

  • Can recursively checkin code of nested checkins although hg status doesn't give much info on file changes within nested repos
  • It appears that I -- and every team member who wants to work on the same project -- has to hand edit their subrepositoies' .hgrc files in order to make the checkin as painless and automated as possible.
  • Can recursively checkin, but recursively checkout is not supported.

Is that a correct analysis of Hg's capabilities?

I'm really hoping not, as that's a lot more stick-shift coding (ie command prompt fiddling all over the place), than the average dev team I've seen could handle, while remaining productive. As I've understood it, refactoring a single assembly would probably grind the team to a halt as they stop to edit the .hgrc files to add location, user and password. No?

And I really want to double check that Hg can't recursively pull? Sounds like such an omission, that I feel I must have missed something.

Thanks!

PS: For the brave or foolish, (and in case it helps), the notes I've been keeping as I work around the problem of projects that reference library modules that reference other library modules, is as follows (note the ???? QUESTIONS??? interspersed in them...

MERCURIAL 

# requires an .hgsub with a ref to either
# an Hg Repo for only one Bin...?
# a website download...is that possible?
# an svn repo that allow referencing just one folder in it
# eg: "BIN/A3rdParty = svn:^/BinCache/A3rdParty/bin"


LibA\
     hg\
        .hgrc 
        # ??? QUESTION ???
        # does each user have to edit their own files by hand 
        # to allow automatic push/pull?
        # "default = https://user:[email protected]/xact/liba"
        # "default-push = https://user:[email protected]/xact/liba"
     .hgsub
     # Map of nested repos as follows:
     # "BIN/A3rdParty = svn:^/BinCache/A3rdParty/bin"
     # "EXT/LibA = https://bitbucket.org/xact/liba"
     # "EXT/LibB = https://bitbucket.org/xact/libb"
     LibA.sln
     BIN\
         [A3rdParty\SomeLib.dll]
     EXT\
     SRC\
         LibA\LibA.csproj
         # ...which References "..\..\BIN\A3rdParty\SomeLib.dll"
         LibA.Tests\LibA.Tests.csproj
         # ...which References "..\LibA\LibA.csproj"


LibB\
     hg\
        .hgrc 
        # ??? QUESTION ???
        # does each user have to edit their own files by hand 
        # to allow automatic push/pull?
        # "default = https://user:[email protected]/xact/libb"
        # "default-push = https://user:[email protected]/xact/libb"
     .hgsub
     # that contains:
     # "BIN/A3rdParty = svn:^/BinCache/A3rdParty/bin"
     # "EXT/LibA = https://bitbucket.org/xact/liba"
     # ??? QUESTION ???
     # do end users add user/pwd info here? or in the 
     # nested repos .hgrc file?
     LibB.sln
     BIN\
         [A3rdParty\SomeLib.dll]
     EXT\
         LibA\
              hg\
                .hgrc 
                # ??? QUESTION ???
                # does each user have to edit their own files by hand 
                # to allow automatic push/pull?
                # "default = https://user:[email protected]/xact/liba"
                # "default-push = https://user:[email protected]/xact/liba"
              LibA.csproj
              # ...which References "..\..\BIN\A3rdParty\SomeLib.dll"
              LibA.Tests\LibA.Tests.csproj
              # ...which References "..\LibA\LibA.csproj"
     SRC\
         LibB\LibB.csproj
         # ...which References "..\..\EXT\LibA\LibA.csproj"
         LibB.Tests\LibB.Tests.csproj
         # ...which References "..\LibB\LibB.csproj"


ProjA\
      hg\
        .hgrc 
        # ??? QUESTION ???
        # does each user have to edit their own files by hand 
        # to allow automatic push/pull?
        # "default = https://user:[email protected]/xact/proja"
        # "default-push = https://user:[email protected]/xact/proja"
      .hgsub
      # that contains:
      # "BIN/A3rdParty = svn:^/BinCache/A3rdParty/bin"
      # "EXT/LibA = https://bitbucket.org/xact/liba"
      # "EXT/LibB = https://bitbucket.org/xact/libb"
      # ??? QUESTION ???
      # do end users add user/pwd info here? or in the 
      # nested repos .hgrc file?
      BIN\
          [A3rdParty\SomeLib.dll]
      EXT\
          LibA\
               hg\
                .hgrc 
                # ??? QUESTION ???
                # does each user have to edit their own files by hand 
                # to allow automatic push/pull?
                # "default = https://user:[email protected]/xact/liba"
                # "default-push = https://user:[email protected]/xact/liba"
               LibA.csproj
               # ...which References "..\..\BIN\A3rdParty\SomeLib.dll"
               LibA.Tests\LibA.Tests.csproj
               # ...which References "..\LibA\LibA.csproj"
          LibB\
               hg\
                .hgrc 
                # ??? QUESTION ???
                # does each user have to edit their own files by hand 
                # to allow automatic push/pull?
                # "default = https://user:[email protected]/xact/libb"
                # "default-push = https://user:[email protected]/xact/libb"
               LibB\LibB.csproj
          # ...which References "..\..\EXT\LibA\LibA.csproj"
          # Important: note that it is same path offset
          # as when within context of LibB.sln
          LibB.Tests\LibB.Tests.csproj
          # ...which References "..\LibB\LibB.csproj"
      SRC\
          ProjA\ProjA.csproj
          ProjA.Tests\ProjA.Tests.csproj
1

There are 1 answers

14
Martin Geisler On

I will try to answer some of your questions though I really think you should discuss this with us instead of doing a Q&A here.

Right now, it appears that

  • Can recursively checkin code of nested checkins although hg status doesn't give much info on file changes within nested repos

See hg status --subrepos or hg status -S for short.

  • It appears that I -- and every team member who wants to work on the same project -- has to hand edit their subrepositoies' .hgrc files in order to make the checkin as painless and automated as possible.

No need to put usernamed and passwords into the .hg/hgrc files -- you should instead configure caching of HTTP credentials in Mercurial.

  • Can recursively checkin, but recursively checkout is not supported.

Checkout, i.e., update, is recursive. When you do hg clone to get a local repository, then Mercurial will notice the .hgsub and .hgsubstate files and it will recursively clone the subrepositories referenced there.

And I really want to double check that Hg can't recursively pull? Sounds like such an ommission, that I feel I must have missed something.

Yes, you're missing how Mercurial knows which subrepositories you want. Please see the documentation on the wiki or the Kick Start guide.