[Mercurial] [Subrepository] Issue with pushing "master" repository, containing multiple subrepositories

hg

#1

Dear all,

I have an issue while pushing a repository containing multiple subrepositories.

I will write a little introduction into more complex problem that we have, and maybe someone could propose a better solution for the whole idea.

First of all, we have many legacy applications. They share multiple dependencies (middleware code), each in other repository (6 repositories). More or less they share the same versions of these dependencies… More or less…

I read a little about subrepositories and it sounds like a perfect solution for us. What I would like to achive is to create a “master” repository, containing multiple subrepositories. The are many advantages of this solution:

  • we can keep the repositories for the dependencies and applications separately like now (each of them has many branches, bookmars, tags, and of course, important history)
  • on each commit on the “master” repository, a hash of each current subrepository commit is saved, so each time we update to any “master” revhash, we update to a consistent state.

Of course there is more, but those two are crucial.

In the mercurial wiki (https://www.mercurial-scm.org/wiki/Subrepository) I read about a perfect solution, where we could have something like one codebase for application and its depedenencies.

First of all I have created a new group “main” on RhodeCode and a completely new repository “master” in it. Later I have cloned it and I have cloned the dependencies’ repositories and the application’s one into the “master” repository. I have added all of them to the .hgsub file just like in the wiki page.

The directory structure is:

master (parent)
|.hg
|.hgsub
|.hgsubstate
|- dependency1
|- dependency2
|- dependency3
|- dependency4
|- dependency5
|- dependency6
|- application1

Everything works perfectly fine on my local machine. Branching, bookmarks, commits and so on.

Unfortunately, during the initial push - “hg push” from directory master - to the RhodeCode I encounter an error about lack of privilages for “dependency1”.

Some logs:

pushing to ssh://rhodecode@XXX/main/master remote: 2018-11-30 16:39:14.491 [49535] INFO [rhodecode.model] initializing db for postgresql://rhodecode:XXXXX@XXX:XX/rhodecode remote: 2018-11-30 16:39:14.493 [49535] INFO [rhodecode.config.environment] Enabled VCS backends: ['hg', 'svn', 'git'] remote: 2018-11-30 16:39:19.060 [49535] INFO [rhodecode.config.middleware] Pyramid app <function pyramid_app_with_cleanup at 0x7fa9f22cf8c0> created and configured. remote: 2018-11-30 16:39:19.513 [49535] INFO [rhodecode.apps.ssh_support.lib.backends.base] READ Permissions for User "<User('some-user-id')>" detected to repo "main/master"! pushing subrepo dependency1 to ssh://rhodecode@XXX/main/master/dependency1 remote: 2018-11-30 16:39:29.960 [49555] INFO [rhodecode.model] initializing db for postgresql://rhodecode:XXXXX@XXX:XX/rhodecode remote: 2018-11-30 16:39:29.961 [49555] INFO [rhodecode.config.environment] Enabled VCS backends: ['git', 'hg', 'svn'] remote: 2018-11-30 16:39:34.554 [49555] INFO [rhodecode.config.middleware] Pyramid app <function pyramid_app_with_cleanup at 0x7f63a86a30c8> created and configured. remote: 2018-11-30 16:39:34.864 [49555] ERROR [rhodecode.apps.ssh_support.lib.backends.base] user<User(‘some-user-id’)>permissions to repo:main/master/dependency1 are empty. Forbidding access. abort: no suitable response from remote hg!

Do you have any ideas how to properly initialize those subrepositories under master repository?

Thanks in advance,
BR,
Mieszko


#2

Hello,

I have managed to finally push it :slight_smile:

I had to reconfigure the .hgsub file.

The problematic version was:

dependency1 = dependency1
dependency2 = dependency2
dependency3 = dependency3
dependency4 = dependency4
dependency5 = dependency5
dependency6 = dependency6
application1 = application1

Where on the left side are aliases and on the right side - the location. In the version above, the location was a relative path to the directory containing the repository.

I changed it to:

dependency1 = ssh://rhodecode@XXX.XXX/dependency1
dependency2 = ssh://rhodecode@XXX.XXX/dependency2
dependency3 = ssh://rhodecode@XXX.XXX/dependency3
dependency4 = ssh://rhodecode@XXX.XXX/dependency4
dependency5 = ssh://rhodecode@XXX.XXX/dependency5
dependency6 = ssh://rhodecode@XXX.XXX/dependency6
application1 = ssh://rhodecode@XXX.XXX/application1

Now on the right side we have remote locations for those repositories and it works :slight_smile: