Mercurial > hg
view tests/test-convert-tagsbranch-topology.t @ 33003:f63d111258da
revset: add startdepth limit to ancestors() as internal option
This is necessary to implement the set{gen} (set subscript) operator. For
example, set{-n} will be translated to ancestors(set, depth=n, startdepth=n).
https://www.mercurial-scm.org/wiki/RevsetOperatorPlan#ideas_from_mpm
The UI is undecided and I doubt if the startdepth option would be actually
useful, so the option is hidden for now. 'depth' could be extended to take
min:max range, in which case, integer depth should select a single generation.
ancestors(set, depth=:y) # scan up to y-th generation
ancestors(set, depth=x:) # skip until (x-1)-th generation
ancestors(set, depth=x) # select only x-th generation
Any ideas are welcomed.
# reverse(ancestors(tip)) using hg repo
3) 0.075951
4) 0.076175
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Jun 2017 00:40:58 +0900 |
parents | 86fe3c404c1e |
children |
line wrap: on
line source
#require git $ echo "[core]" >> $HOME/.gitconfig $ echo "autocrlf = false" >> $HOME/.gitconfig $ echo "[core]" >> $HOME/.gitconfig $ echo "autocrlf = false" >> $HOME/.gitconfig $ cat <<EOF >> $HGRCPATH > [extensions] > convert = > [convert] > hg.usebranchnames = True > hg.tagsbranch = tags-update > EOF $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE $ count=10 $ action() > { > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" > git "$@" >/dev/null 2>/dev/null || echo "git command error" > count=`expr $count + 1` > } $ glog() > { > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" > } $ convertrepo() > { > hg convert --datesort git-repo hg-repo > } Build a GIT repo with at least 1 tag $ mkdir git-repo $ cd git-repo $ git init >/dev/null 2>&1 $ echo a > a $ git add a $ action commit -m "rev1" $ action tag -m "tag1" tag1 $ cd .. Convert without tags $ hg convert git-repo hg-repo --config convert.skiptags=True initializing destination hg-repo repository scanning source... sorting... converting... 0 rev1 updating bookmarks $ hg -R hg-repo tags tip 0:d98c8ad3a4cf $ rm -rf hg-repo Do a first conversion $ convertrepo initializing destination hg-repo repository scanning source... sorting... converting... 0 rev1 updating tags updating bookmarks Simulate upstream updates after first conversion $ cd git-repo $ echo b > a $ git add a $ action commit -m "rev2" $ action tag -m "tag2" tag2 $ cd .. Perform an incremental conversion $ convertrepo scanning source... sorting... converting... 0 rev2 updating tags updating bookmarks Print the log $ cd hg-repo $ glog o 3 "update tags" files: .hgtags | | o 2 "rev2" files: a | | o | 1 "update tags" files: .hgtags / o 0 "rev1" files: a $ cd ..