Pull behaviour using branches with bookmarks

Alexander Schatten ml_alexanderschatten at gmx.at
Wed Jan 26 11:05:49 CST 2011


ok, please check out the bash script under the line; includes documentation. In my opinion, the pull behaviour is pretty questionable, particularly as it is not documented anywhere; at least I could not find it:

-------------------------------------------------------------
# first repo
hg init hgtest
cd hgtest
touch a.txt
hg add
hg commit -m "added a.txt" -u "User A"
echo "one line in a.txt" >> a.txt
hg commit -m "one line in a" -u "User A"
hg status
hg glog
cd ..
# clone repo
hg clone hgtest hgtest1
# work in second repo
cd hgtest1
touch b.txt
hg add 
hg commit -m "added b.txt" -u "User B"
hg status
hg glog
# back to first repo
cd ../hgtest
touch d.txt
hg add 
hg commit -m "added d.txt" -u "User A"
# go to second repo and pull changes: branching
cd ../hgtest1
hg pull
hg glog
hg bookmark main -r 3
hg bookmark feature -r 2
hg update feature
echo "one line in b.txt" >> b.txt
hg commit -m "added b.txt" -u "User B"
hg status
hg glog
# back to first repo and adding changes
cd ../hgtest
echo "second line in a.txt" >> a.txt
hg commit -m "second line in a" -u "User A"
# until here everything is fine
# now back to repo 2, and test the two alternatives 
# (1) go to main branch and pull:
cd ../hgtest1
hg update main
hg pull
hg glog
# behaviour as expected: changeset added to main branch, main bookmark moved, feature bookmark untouched
# (2) Alternative: go to feature branch and pull:
cd ../hgtest1
hg update feature
hg pull
hg glog
# what happened: 
# (a) changeset was put on top of feature branch, thus messed up branches!
# (b) bookmarks are messed up, e.g. "main" bookmark is on wrong position
-------------------------------------------------------------


-------- Original-Nachricht --------
> Datum: Wed, 26 Jan 2011 17:30:09 +0100
> Von: Martin Geisler <mg at aragost.com>
> An: "Alexander Schatten" <ml_alexanderschatten at gmx.at>
> CC: mercurial at selenic.com
> Betreff: Re: Pull behaviour using branches with bookmarks

> "Alexander Schatten" <ml_alexanderschatten at gmx.at> writes:
> 
> > Sorry, if I am annoying, I just wonder: no one has an idea about my
> > issue? Or did I explain it unclear or, alternatively, is the question
> > so stupid, that no one bothers to answer... ;-)
> 
> Nah, I think it was a little unclear what the error was and perhaps
> nobody has seen it before.
> 
> > -------- Original-Nachricht --------
> >> Datum: Tue, 25 Jan 2011 14:11:42 +0100
> >> Von: "Alexander Schatten" <ml_alexanderschatten at gmx.at>
> >> An: mercurial at selenic.com
> >> Betreff: Pull behaviour using branches with bookmarks
> >
> >> Hi,
> >> 
> >> 
> >> I am a little bit confused: I tried to use bookmarks for local
> >> feature branches. Now, from time to time I want to pull the last
> >> changes from the main repo.
> >> 
> >> Now my question: I have the impression that pull behaves differently
> >> depending in which branch I am in: if I do an "hg update main" before
> >> the pull the result is different to "hg update feature" before the
> >> pull. This is very confusing to me. The first result is obviously the
> >> desired one, the latter seems to mess up the branches and the
> >> bookmarks.
> 
> Can you tell us what the difference is? Show a short and self-contained
> example of what you mean.
> 
> I'm not using bookmarks myself, so I'm surprised that 'hg pull' should
> behave differently.
> 
> -- 
> Martin Geisler
> 
> aragost Trifork
> Professional Mercurial support
> http://aragost.com/en/services/mercurial/blog/


More information about the Mercurial mailing list