tortoisehg and subrepos
Asked Answered
L

5

9

I can't get Tortoisehg (1.0) to work with subrepos

I have a directory structure like this:

root
  .hg
  .hgsub
  .hgsubstate
  Customer1
    Project1
      .hg
      foo.txt
    Project2
      .hg
  Customer2
    Project3
      .hg

the .hgsub file under root looks like

Customer1\Project1=Customer1\Project1  
Customer1\Project2=Customer1\Project2  
Customer2\Project3=Customer2\Project3  

If modify the file Customer1\Project1\foo.txt and commit from the root it works

>hg ci -m "command line commit"
committing subrepository customer1\project1

in Tortoisehg customer1\project1 is displayed with status S (subrepo) but when commiting I get a message

abort: customer1/project1: no match under directory!

Is this scenario not supported or am I doing something wrong?

The doc says:
"TortoiseHg 1.0 introduced rudimentary support for subrepositories, and only in the commit / status tool. When Mercurial considers a subrepo as dirty, it will appear in the commit tool as a special entry in the file list with a status of S. If a subrepo is included in the file list of a commit, the subrepo is committed along with the other changes, updating the .hgsubstate file in the main repository root."

Lochner answered 20/3, 2010 at 19:51 Comment(1)
I have the same issue. It seems that maybe it does have something to do with "tortoisehg tries to commit customer1/project1 instead of customer1\project1 (backslash)" Committing from the command line causes no issues.Scherer
E
9

I had pretty much the same problem and started trying a whole bunch of variations and I finally got it working for me by using a forward-slash (/) on both sides of the equals sign and not a back-slash (\) anywhere.

So try...

Customer1/Project1=Customer1/Project1  
Customer1/Project2=Customer1/Project2  
Customer2/Project3=Customer2/Project3 

Also, when it was not working, my .hgsubstate file only had a bunch of zeros in it. When it started working, it had a genuine GUID in it.

Erotic answered 4/11, 2010 at 5:15 Comment(1)
Thanks, I have moved away from subrepos so I don't need it myself but I trust your research and mark this as answer.Lochner
W
7

I was able to get past this problem by committing using the command line for the main repo.

hg commit -m 'Updated subrepo'
Wildlife answered 21/11, 2012 at 17:7 Comment(0)
A
4

I had the same problem:

In one of my repositories committing of one of my changed subrepo modules failed with message

"abort: mysubrepo: no match under directory!"

The reason:

TortoiseHG fails to commit to the subrepository because it handles folder names case-sensitive!

Example: Your original repository:

C:\Shared\MySubRepo

Cloning this as a subrepo into another repository by command line

hg clone C:\shared\mysubrepo   <--- Note the lower cases!

will create a subrepo folder mysubrepo inside your parent repository. Adding it to the .hgsub file as usual (I always use the platform independent '/' instead of '\', so I don't think that's the reason for the error). Trying to commit with --subrepos TortoiseHG will end up with the "no match under directory!" error. However, commiting by command line works.

After renaming the subrepo folder mysubrepo to MySubRepo (as the original folder with upper cases) TortoiseHg could commit successfully!

Maybe you have to edit the folder name also in the hgrc file, but I'm not sure if this is really neccessary, because I renamed it in the file before figuring out, that there are canse-sensitive differences in the folder name iteself. Also removing the repository from TortoiseHg Workbench's repository registry and readding it may be needed (and/or restart of the Workbench as well).

Aldebaran answered 4/7, 2013 at 11:49 Comment(0)
O
2

I think your problem is with specifying "Customer1\Project1" as a sub repository because Customer1 should be a nested repository as well.

Customer1 and Customer2 should both have '.hgsub' files describing the subrepos inside them (Project1/2)

Remake your Customer1 repository elsewhere and clone Project1 and Project2 into it. Add Project1 and Project2 entries to the '.hgsub' file within Customer1.

Then do the same for a Customer2 repository.

Remember that nested repositories can themselves be nested so create a 'root' repository and then clone Customer1 and Customer2 into it remembering to add entries to the .hgsub file.

Commit 'root' and you should be fine.

The key is to push changes from all instances of a subrepos to its clone master so that other clones that include that subrepos are able to pull that revision if needed.

I have all master repos in the same parent folder on my machine so it makes putting relative paths inside '.hgsub' files such as '../Project1' or '../Customer1' a simple way to push changes to my local clones from our central server.

As far as using TortoiseHG, you will be fine with v1.0 as it will create and manage the '.hgsubstate' file in a nested repository as long as you have already created the '.hgsub' file!

Oehsen answered 22/3, 2010 at 22:45 Comment(1)
It is much easier to just use the command line for the top level commit. My guess is that tortoisehg tries to commit customer1/project1 instead of customer1\project1 (backslash).Lochner
V
1

Adding my 2 cents.

I was receiving this error abort: customer1/project1: no match under directory on Windows in the following scenario:

  • repo was in a folder named MyFolder (note the upper case)
  • repo had a subrepo
  • some files (only some!) in the parent repo were commited using myfolder/filename.ext (note the lowercase)

Everything works fine, commandline commits work fine, but Tortoise complains.

Rename the files (find the lowercase ones using hg status --all and you're fine)

Vilify answered 11/12, 2016 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.