schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

Several fixes for Mercurial 1.8 #200

Closed sampsyo closed 13 years ago

sampsyo commented 13 years ago

Maybe this is a breach of GitHub etiquette, but this request encapsulates several fixes.

First, there are some extremely hacky changes that make some tag mappings work. There was some dead code that was never being executed, which I don't really understand, but this was preventing the use of mappings for Mercurial tags (to correspond to git tags) when they don't correspond exactly to the .hgtags file. (Sorry for changing around what I don't understand, but the first two commits make tags work reliably for me.)

Second, another in the category of hacks on things I don't fully understand, I fixed what I think is a bug in "outgoing" that caused everything to appear as if it was outgoing. (The "base" parameter, which indicates what is in common between the local and remote repositories, was always empty.)

Finally, one change I actually do understand: I made new clones "activate" the master bookmark automatically. This fixes a problem in which a clone-commit-push pattern would create dangling commits because the master bookmark was not moved to point to the new commits. (As of Mercurial 1.8, a bookmark has to be activated before it is moved -- much like a git branch.)

If I've seriously messed things up, please let me know and I'll keep working on a cleaner fix.

durin42 commented 13 years ago

Not sure what's up with ALDS in all those comments. A couple of the commits seem very strange and/or incorrect to me. When you're ready, I'd appreciate emailing the patches (with 'hg email' or whatever the git equivalent (send-email? I think...)) to the hg-git Google Group, as that's my preferred way to get patch submissions (it's worlds easier to review.)

sampsyo commented 13 years ago

Thanks for looking at my changes, as embarrassingly bad as they were.

I didn't know there was a mailing list; I'll sign up for that and send along a new patch straightaway.

Thanks again for your patience and all your work on hg-git so far.

mcclure commented 13 years ago

Hello-- so is this fix going in or not? I have been experiencing the "outgoing" bug and it is a really big problem, so if that patch at least could get put in it would be much appreciated.

Also I can't comment on the suspected bad side effects, but I think some form of the auto-master fix is extremely desirable. As it is basically every time you clone you have to remember to type that extraneous "hg update master" or else your next commit will be rejected on push because it doesn't have that magic bookmark associated with it. (If I understand durin42's objection correctly-- maybe a smarter way to get the same effect sampsyo desires would be to automatically activate whatever bookmark is associated with tip? That way you activate master if master is tip and whatever other branch otherwise.)

sampsyo commented 13 years ago

I agree -- activating the bookmark on tip seems like a better solution that activating "master" indiscriminately. I'll look into putting together a patch to that effect.

sampsyo commented 13 years ago

Latest change on my fork adds that behavior.