P3:D2::Recognition of repo source?

Issue #3 resolved
Marko Käning
created an issue

It would be cool if MacHg would automatically set the correct the advanced options for a local clone.

I mean, a specific clone keeps information about it's origination in .hg/hgrc like for example this: {{{ [paths] default = ssh://hg@bitbucket.org/mkae/makeicns }}}

But, if I pull a local clone into your "Repositories" view MacHg pretends to not to know anything about it, although it could fill in the missing bits of the "Advances options" for pull, push, in and out itself.

Am I missing something? Is this perhaps already implemented and I was just not able to find the right buttons?

Comments (16)

  1. Jason Harris repo owner

    Sorry. I am not sure I understand the question.

    Say you have a repository and its clone -- say foo and fooClone -- in the same document. These are compatible repositories right.

    (Compatible means that running 'hg identify -r 0' on both repositories from the command line gives the same results. Ie they have the same root)

    If you now click on say fooClone in the side bar you should see a badge appear next to foo giving the incoming and outgoing counts from fooClone <-> foo. In fact you should see all incoming and outgoing counts from fooClone to all other compatible repositories. Like in this picture.

    Now when you elect to push from fooClone a sheet will come up where you need to choose a destination. If you only have fooClone and foo in your document, when you push from say fooClone the destination popup in the push sheet should be filled out with foo (its the only compatible repository). Is this not happening for you?

    Further if you have multiple compatible repositories the starting destination will be the last destination you pushed to. It will also remember which options you used in pushing to that repository.

    However right now you have to save the document to get these options remembered. (The options are saved in the document... I am going to change this so that these pushing / pulling etc options are stored in the preferences.) Inside the code base if you are interested these are called connections. So the connections are going to be saved in the preferences.

    Did that answer your question?

  2. Marko Käning reporter

    OK, I'll try again to describe what I meant:

    • I cloned this repo locally on the command line
    • Now I want to let MacHg take control over it!
    • So I just drag the local clone's folder from my finder into the repository area in the left pane of MacHg
    • The clone appears now as a fully functional repository in MacHg, all is fine, BUT...
    • ... when I now want to pull from the original repo at bitbucket
    • ... MacHg doesn't know anything about the origin of this repo
    • ... although the information is in principle in the .hg/hgrc config file saved

    I hope that makes it clearer.


    So, you are saying that I have to specify the path to the original once again in MacHg, disregarding the settings in .hg/hgrc of said clone!?

    Did I get this right?

    If so, I think it would be a valuable option to offer the current settings as default values for accessing the original repo.

  3. Jason Harris repo owner

    Ahhh... No

    I understand what you are asking. You have to create a server repository reference. In the menu Repository there is an item 'Add Server Repository...' choose that menu item, and fill out the server details and a server will appear in the sidebar. Then when you push this will be chosen.

    The thing is, in a multi repository world you might want to push / pull to many different servers or local copies. In fact pushing or pulling from a local clone is sort of the same as pushing pulling to a server. There is not always an official blessed server for every repository! This is a whole aspect of *distributed* revision control. There is no central "the one" server to rule them all... (Of course I know in your case in your work flow there is, but in the Mercurial scheme of things there isn't.)

    Try the above to see if it solves your problems.

    Then lets discuss ways that we could make this clearer. Ie we could

    • Auto-create a server reference if no compatible server reference exists in the sidebar already.
    • When selecting push we could put up a dialog saying (no compatible server references where found. Would you like to create a server reference to blah-blah...)

    Do you have other suggestions as a nice UI way to inform you of what to do?

  4. Marko Käning reporter

    Well, I do think that's what MacHg should take off the shoulders of the dummy user! If it wants a server reference, self-create it, but don't bother the user with this, since all necessary info is available!

    I'll happily serve as a ginny-pig once you come up with a UI suggestion. :)

  5. Jason Harris repo owner

    First this fixed your problem right?

    Next, I am thinking about the best way to do this... How best to auto create a server reference if none exists, but yet not be annoying...

  6. Marko Käning reporter

    Sorry, in my previous post I did not yet test that. Now that you ask I did it and it worked as expected. I just entered the complete repository path and it worked. I had to drag my local clone into the pane and I could do pull/push/in/out with it now. :) Great!


    Well, still, I find it confusing that I have to do all this manually. So, I guess as said above, if you drag a local clone into the left pane it should look for the path from where it was cloned and use that for an auto-creation of a server repo. You could use the same dialog which you use in "Repository/Add Server Repository..." with the server's URL already preset, giving the user to change the (from the path derived) default name for the server bookmark.

    Furthermore I'd keep all server-repos in a separate repository group, which I did manually now. (Well, I think this is rubbish, since it would be a conceptual change to your approach of compatible repos. So forget this!)

  7. Jason Harris repo owner

    Thanks! Ok, I think I will add this as an enhancement. So the enhancement would be

    1. If you drag-and-drop in an existing repository from the finder into the document side bar, and
    2. that repository has a URL in its [paths] default section in the repository/.hg/hgrc and
    3. There is no compatible server with the extracted URL

    Then a sheet dialog will pop up asking if you want to auto create the server repository.

    There will be a popup item in preferences with title Auto-create ServerReference with values Ask | Never | Always with default being Ask.

    How does that sound?

  8. Blake Winton

    I would expect drag and drop to work the same way as "Add Local Repository…", so I was surprised to find out that you only added the remote server reference when I dragged and dropped.

    And, when I dragged and dropped a repo with:

    default = /Users/bwinton/Programming/thunderbird/src-central
    default-push = ssh://moz/users/bwinton_latte.ca/prefsui/

    in its .hg/hgrc, I didn't get a remote server for the push.

    (I have a .ssh/config file with a definition for "moz".

    Host moz
      HostName hg.mozilla.org
      User bwinton@latte.ca
      IdentityFile ~/.ssh/bwinton.key


    Thanks, Blake.

  9. Gustavo Picón
    • changed status to open

    This is only working with default/default-push [paths] entries. It should work with any entry listed there. For instance I use a "default" entry to my server, "bb" for bitbucket and "github" for a hg-git mirror. The logic is all the same.

  10. Log in to comment