mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
merge bookmarks
This commit is contained in:
commit
6cfe681282
@ -200,10 +200,7 @@ def reposetup(ui, repo):
|
||||
return node
|
||||
|
||||
def addchangegroup(self, source, srctype, url, emptyok=False):
|
||||
try:
|
||||
onode = repo.changectx('.').node()
|
||||
except RepoError, inst:
|
||||
pass
|
||||
parents = repo.dirstate.parents()
|
||||
|
||||
result = super(bookmark_repo, self).addchangegroup(
|
||||
source, srctype, url, emptyok)
|
||||
@ -214,7 +211,7 @@ def reposetup(ui, repo):
|
||||
marks = parse(repo)
|
||||
update = False
|
||||
for mark, n in marks.items():
|
||||
if n == onode:
|
||||
if n in parents:
|
||||
marks[mark] = node
|
||||
update = True
|
||||
if update:
|
||||
|
38
tests/test-bookmarks-rebase
Executable file
38
tests/test-bookmarks-rebase
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "[extensions]" >> $HGRCPATH
|
||||
echo "rebase=" >> $HGRCPATH
|
||||
echo "bookmarks=" >> $HGRCPATH
|
||||
|
||||
cleanoutput () {
|
||||
sed -e 's/\(Rebase status stored to\).*/\1/' \
|
||||
-e 's/\(Rebase status restored from\).*/\1/' \
|
||||
-e 's/\(saving bundle to \).*/\1/'
|
||||
}
|
||||
|
||||
echo % initialize repository
|
||||
hg init
|
||||
|
||||
echo 'a' > a
|
||||
hg ci -A -d '0 0' -u test -m "0"
|
||||
|
||||
echo 'b' > b
|
||||
hg ci -A -d '0 0' -u test -m "1"
|
||||
|
||||
hg up 0
|
||||
echo 'c' > c
|
||||
hg ci -A -d '0 0' -u test -m "2"
|
||||
|
||||
echo 'd' > d
|
||||
hg ci -A -d '0 0' -u test -m "3"
|
||||
|
||||
hg bookmark -r 1 one
|
||||
hg bookmark -r 3 two
|
||||
|
||||
echo % bookmark list
|
||||
hg bookmark
|
||||
|
||||
echo % rebase
|
||||
hg rebase -s two -d one 2>&1 | cleanoutput
|
||||
|
||||
hg log
|
42
tests/test-bookmarks-rebase.out
Normal file
42
tests/test-bookmarks-rebase.out
Normal file
@ -0,0 +1,42 @@
|
||||
% initialize repository
|
||||
adding a
|
||||
adding b
|
||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
||||
adding c
|
||||
created new head
|
||||
adding d
|
||||
% bookmark list
|
||||
* two 3:2ae46b1d99a7
|
||||
one 1:925d80f479bb
|
||||
% rebase
|
||||
saving bundle to
|
||||
adding branch
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 1 files (-1 heads)
|
||||
rebase completed
|
||||
changeset: 3:9163974d1cb5
|
||||
tag: tip
|
||||
parent: 1:925d80f479bb
|
||||
parent: 2:db815d6d32e6
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: 3
|
||||
|
||||
changeset: 2:db815d6d32e6
|
||||
parent: 0:f7b1eb17ad24
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: 2
|
||||
|
||||
changeset: 1:925d80f479bb
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: 1
|
||||
|
||||
changeset: 0:f7b1eb17ad24
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: 0
|
||||
|
44
tests/test-bookmarks-strip
Executable file
44
tests/test-bookmarks-strip
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "[extensions]" >> $HGRCPATH
|
||||
echo "bookmarks=" >> $HGRCPATH
|
||||
echo "mq=" >> $HGRCPATH
|
||||
|
||||
hg init
|
||||
|
||||
echo qqq>qqq.txt
|
||||
|
||||
echo % add file
|
||||
hg add
|
||||
|
||||
echo % commit first revision
|
||||
hg ci -m 1 -u user -d "1 0"
|
||||
|
||||
echo % set bookmark
|
||||
hg book test
|
||||
|
||||
echo www>>qqq.txt
|
||||
|
||||
echo % commit second revision
|
||||
hg ci -m 2 -u usr -d "1 0"
|
||||
|
||||
echo % set bookmark
|
||||
hg book test2
|
||||
|
||||
echo % update to -2
|
||||
hg update -r -2
|
||||
|
||||
echo eee>>qqq.txt
|
||||
|
||||
echo % commit new head
|
||||
hg ci -m 3 -u user -d "1 0"
|
||||
|
||||
echo % bookmarks updated?
|
||||
hg book
|
||||
|
||||
echo % strip to revision 1
|
||||
hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
|
||||
|
||||
echo % list bookmarks
|
||||
hg book
|
||||
|
24
tests/test-bookmarks-strip.out
Normal file
24
tests/test-bookmarks-strip.out
Normal file
@ -0,0 +1,24 @@
|
||||
% add file
|
||||
adding qqq.txt
|
||||
% commit first revision
|
||||
% set bookmark
|
||||
% commit second revision
|
||||
% set bookmark
|
||||
% update to -2
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
% commit new head
|
||||
created new head
|
||||
% bookmarks updated?
|
||||
test 1:16b24da7e457
|
||||
test2 1:16b24da7e457
|
||||
% strip to revision 1
|
||||
saving bundle to
|
||||
saving bundle to
|
||||
adding branch
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 1 files
|
||||
% list bookmarks
|
||||
* test 1:9f1b7e78eff8
|
||||
* test2 1:9f1b7e78eff8
|
Loading…
Reference in New Issue
Block a user