Error when importing existing Mercurial repository

I followed the instructions here - https://scm-manager.org/docs/3.3.x/en/import/ - for creating a new repo through the web interface and then using the hg commands to import over the repo data.
It processes for awhile and looks like its going well but then throws this error: “default branch cannot be deleted”.

Full command line output looks like this:
hg push
pushing to http://localhost:8080/scm/repo/scmadmin/OUR_NEW_REPO
http authorization required for http://localhost:8080/scm/repo/scmadmin/OUR_NEW_REPO
realm: SONIA :: SCM Manager
user: scmadmin
password:
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 50370 changesets with 291093 changes to 130122 files (+176 heads)
remote: [SCM] Error: default branch cannot be deleted
remote: transaction abort!
remote: rollback completed
remote: pretxnchangegroup.scm hook failed
abort: push failed on remote

When I look at the Web interface for that repo, it shows as “No branches found”.

Maybe I’m missing something simple?
Thanks for any insight!

Hi @jsgro ,

does your imported repository has a default branch? For SCM-Manager, this branch is essential and we cannot handle repositories without this branch. If there is such a branch, we have to take a closer look.

Regards
René

Hi again,

I missed a point. To import existing repositories, please try the import mechanism of SCM-Manager. You can find this on the “Add Repository” page on the top right corner.

We’ll update the documentation on this point.

Regards
René

Thanks for the responses.

A day prior, I had tried the “Import Repository” method from the web interface but got this error/output:
Import of repository scmadmin/OUR_NEW_REPO
Repository type: hg
Imported from: URL
Imported by scmadmin (scmadmin)
2024-08-12T19:05:24.781928500Z - import started
2024-08-12T19:05:24.799565800Z - pulling repository from http://…our repo…
2024-08-12T19:05:25.391158500Z - import failed (see next log entry)
Cannot invoke “sonia.scm.io.INIConfiguration.getSection(String)” because “this.hgrc” is null

So then I tried the method outlined above.

Yes, we have a default branch in the repo being imported.

Something I just noticed when looking at the “Add Repository” interface on the web again, is there’s the “Initialize Repository” checkbox. When I created the new repo to import into, I did not have that checked (because why would I want an initial default branch when I’ll be importing my own).
But do I need that set? The error about “default branch cannot be deleted” sounds related.

Hi @jsgro ,

now I’m a bit confused. When you use the import page, there is no “Initialize Repository” checkbox, so … no, this does not have to be set whatsoever if you want to use this for an existing repository.

Could you send us the complete stack trace of the error? This should be found in the SCM-Manager logs when you try to import the repository once more.

Thanks!
René

Sorry for the confusion. I was trying to explain that I had tried two different methods for setting up and importing the repo.
As I understand it, there’s 2 ways to go about this:

Method A)
-use the Import Repository option at http://localhost:8080/scm/repos/create/import
-Import via URL
(this is failing - i’ve attached the logs)

Method B)
-use the Create Repository option at http://localhost:8080/scm/repos/create/import
-this is where I was saying I have had “Initialize Repository” unchecked
-then did the hg clone, hg pull, hg push (as outlined here https://scm-manager.org/docs/3.3.x/en/import/#mercurial)
(this is failing with the error i reported in the my first post)

In the logs that I attached - I changed any confidential URLs/names)
Thanks,
logs.zip (9.5 KB)

I’m sorry, the relevant exception is only logged, when TRACE is enabled. This can best be done using the Support Plugin. If this is installed, you will find a Navigation entry “Support” in the Administration view. Here you can click the “Start” button, then try to import the repository once more, and click “Stop and collect” afterwards. You will get a zip file with the logs (“scm-manager.log”). Can you send this one (you should search for sinsible data beforehand, though passwords should not be looged).

Ok, I’ve tried the Import Repository again with the log trace enabled.
I’ve attached the logs.
Also to note - I have been able to successfully import a smaller repo, so I know there isn’t something fundamentally wrong with our mercurial server.
SCMLogs.zip (110.8 KB)
Thanks for the help.

Thanks for your logs! That’s interesting. There’s an exception in a clean-up step, I do not really understand how it can happen. I think, that it hides another error, but that’s only a wild guess.

I will check whether we can create a bugfix release for this. Otherwise maybe I’d could send you a test release so that you could run the import there for further analysis.

I’ll get in touch with you. Thanks so far,

René

Ok, thanks for looking deeper into it. I’d be willing to try a test release.

Hi again, we just released version 3.4.1 with a fix. We would be greatful if you’d give it a try. Thanks for your patience!

That worked! Thanks so much.

Next question - what’s the process for importing subrepositories?
After the import, in the “Code” web view, I see folders that are flagged as subrepositories but they look like just placeholder stubs for them.
I also found this page - https://scm-manager.org/plugins/scm-hgnested-plugin/docs/3.0.x/en/usage/ - but I’m not clear what the process is when doing an import.

I’m glad to read this :slight_smile:
Subrepositories have to be imported in separate repositories in SCM-Manager, they are not kept as subrepositories directly beneath the parent repo or something like that. Using the hgnested plugin, you can configure the links to the subrepos inside of SCM-Manager. May I refer to the initial issue on GitHub that made us port the hgnested plugin for version 3?
Hope that you will find some answers there.

I was able to setup the subrepositories. Thank you.

Hopefully last issue/question:
all is good on the server side - i can access scm-manager from http://localhost:8100/scm/ (and clone repos from that URL)
(also works from the internal IP address such as: http://192.168.0.253:8100/scm/)

but i’m unable to access scm-manager (or clone) from outside the local network. I’ve checked the router settings and it looks to be configured correctly for port-forwarding).
what am i missing?

Hey @jsgro , there can be dozens of reasons.

Do you use a reverse proxy? Then you could take a look here: https://scm-manager.org/docs/3.4.x/en/administration/reverse-proxies/

What do you get? A “connection refused”? Then it could be the router or some firewall settings.

Do you get anything at all?

Not using a proxy.

Get this message from the browser:
This site can’t be reached
OUR_IP_ADDRESS took too long to respond.
Try:
-Checking the connection
-Checking the proxy and the firewall
ERR_CONNECTION_TIMED_OUT

I can definitely connect to that IP through other means.

You are running SCM-Manager on Windows, right? I’m not really familiar with Windows, but the firewall is application specific, isn’t it? Is Java allowed to listen to external IP addresses? SCM-Manager does not filter by default (unless you have changed the Jetty configuration).

I figured it out with the help of this post - Why can't I access my server from another machine in the same network?
The issue was that I needed to add Java to the firewall exceptions.
I’m all set now, thanks again.

1 Like

We’re glad to hear this. Thanks for the feedback!