Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sourcetree fails to open repository after converting it from hg -> git

AndreasLoew April 15, 2013

I've started converting my projects from hg -> git - which works all fine. Except that SourceTree complains about not finding a .hg directoy in the git project.

I tried deleting the bookmarks - which worked for the main repository but not for the sub repositories.

It seems that Sourcetree somewhere stores a cache bound to the path of the project. How can I delete this? (MacOS)

5 answers

1 accepted

0 votes
Answer accepted
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2013

Actually, the bug report might not be necessary. There's a couple of things here. Firstly, we can't expect SourceTree to know a repository has been converted on-the-fly. It's added as a hg/git repo, so SourceTree will assume that's what it is. You'd have to re-add it. The second point is that submodules are handled differently between each repo type. In git it's in a .gitmodules file and in hg it's in a .hgsub file.

You'd have to figure out what tool you're using is doing to the repository's submodules configuration, this isn't really down to us. In your case you need to ensure there's a valid .gitmodules file in your repo (ls -a in the terminal for that folder). If there isn't, then you'd need to create it and mimic the configuration you previously had in the .hgsub file.

I'll close the JIRA issue I created as this is a conversion issue rather than a SourceTree issue.

Feel free to fire me more questions relating to it.

EDIT: Here's a link which may help

0 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2013

Hi Andreas,

I've raised a bug report in JIRA for this one. Editing the browser.plist file would most likely fix this issue which is located in ~/Library/Application Support/SourceTree/browser.plist (make sure you always back it up first before editing it). This isn't a solution, just a workaround in the meantime. You may need to delete any relative submodules out to that entry in this XML file that could be affecting it. Check the bug report for more details and add yourself as a watcher, I'll be working on it from today as you've rightly pointed out how it gets affected with submodules.

Hope that helps

0 votes
AndreasLoew April 21, 2013

A way to reproduce the problem on Mac is

mkdir sourcetreetest

cd sourcetreetest

echo "hello" > readme.txt

hg init

hg addremove

hg commit -m "readme"

stree

When SourceTree opens add repository to the bookmarks. The title bar reads "sourcetreetest (Mercurial)". You see the working copy and the default branch and the commit.

Close Sourcetree.

Back to bash:

rm -rf .hg

git init

git add *

git commit -a -m "readme"

stree

The title bar still reads "sourcetreetest (Mercurial)". The repository is unreadable. Workingcopy only shows a spinning icon.

It seems that this can be fixed by deleting the bookmark.

However if you have subrepositories in Mercurial and after converting the project to git use submodules in the same place deleting the bookmark does not seem to suffice.

0 votes
AndreasLoew April 21, 2013

moved to comment - see above

0 votes
KieranA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2013

Hi Andreas,

When you say SourceTree is complaining, could you be more specific? Does it allow you to re-add the project back to the bookmarks at all?

One thing to check would be to see if your project folder has the necessary hidden folders for SourceTree to determine the repo type. Within the repository folder if you browse to it through the terminal and hit "ls -a" in your case it should show a ".git" directory and ".hg" shouldn't exist at all. Could you clarify this is the case?

When you say sub-repositories, are you referring to a repository that's in a folder in the bookmarks folder?

Cheers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events