import hg repo?

569 views
Skip to first unread message

Michael Grossberg

unread,
Jan 5, 2012, 8:32:17 AM1/5/12
to scmma...@googlegroups.com
Can one import(clone) into scm-manager from an existing hg repo via http. Bittbucket has some thing 
like this, at least if the source repo is visible over http. I was thinking of doing something extremely ugly
like writing a separate app to create an hg repo, e.g. myRepo through scm-manager, then delete it
in /home/scmadmin/.scm/repositories/hg, then copy in the real myRepo. That seems to work. But writing
a separate web service for this is even nastier then what I need to do behind the scenes. Is there
a way do do this more sensibly?  A direct import mechanism (with authorization)
though a RESTful API would really be sweet. 

Sebastian Sdorra

unread,
Jan 5, 2012, 8:48:53 AM1/5/12
to scmma...@googlegroups.com
Hi,
Do not create repositories manually, you will lost all scm-manager hooks!

You could import mercurial repositories in 3 easy steps:
- clone your existing repository, e.g. hg clone
https://bitbucket.org/sdorra/scm-manager
- change the default url in the .hg/hgrc file of the clone to your new
repository (created in scm-manager something like this
http://yorserver:8080/scm/hg/imported)
- than push the repository to your new scm-manager repository, e.g: hg push

Now your repository is imported.

Sebastian

2012/1/5 Michael Grossberg <mich...@gmail.com>:

Michael Grossberg

unread,
Jan 9, 2012, 12:54:21 PM1/9/12
to scmma...@googlegroups.com
First of all thanks so much! That works rather nicely. The one question I have is about the "restful" api. My specific 
question is what can I do to create the a repo using it? For client I can use curl, or pycurl or 
python-requests library but I can't guess API ... is it documented in some way? Is there someway
while using the web interface that I could see the url calls to the API so I could figure it out?
I did some elementary poking at the javascript to see
if the links were visible, lets say on the form for creating a new repo... but it seems to be deeper in the
javascript.

Are all the functions accessible via API? Can one also update/delete repos? 

Thanks again,

michael

Sebastian Sdorra

unread,
Jan 10, 2012, 6:50:05 AM1/10/12
to scmma...@googlegroups.com
Hi,
Each function of the web interface is also available over an restful
web service (xml or json). But if you want to create repositories with
a script or something you could use the cli-client
(https://bitbucket.org/sdorra/scm-manager/wiki/command-line-client).
There is a very basic web service documentation at
http://docs.scm-manager.org/restdocs/current/ and you could monitor
the xhr request from the web interface with the "Developer Tools" from
Google Chrome or Firebug from Mozilla Firefox. Here is a short example
for curl:

curl -u 'scmadmin:scmadmin' -X POST -H "Content-Type: application/xml"
-d '<repositories><name>test</name><type>hg</type><public>true</public><contact>te...@example.com</contact><description>Test
repository</description></repositories>'
http://localhost:8080/scm/api/rest/repositories.xml

Sebastian

2012/1/9 Michael Grossberg <mich...@gmail.com>:

Michael Grossberg

unread,
Jan 12, 2012, 12:51:27 AM1/12/12
to scmma...@googlegroups.com
Thanks again!
That worked very well. Sorry but another question. 

If I want to push myrepo into scm manager


I run into interactive username password. 
Any thoughts on how I can do that push you suggest without resorting to pexpect?

Sebastian Sdorra

unread,
Jan 12, 2012, 2:45:28 AM1/12/12
to scmma...@googlegroups.com
Have a look at the auth section of the .hgrc file
http://www.selenic.com/mercurial/hgrc.5.html#auth

2012/1/12 Michael Grossberg <mich...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages