##// END OF EJS Templates
mq: pop/refresh: avoid losing revisions not managed by mq...
Alexis S. L. Carvalho -
r5980:dcda0c90 default
parent child Browse files
Show More
@@ -0,0 +1,44 b''
1 #!/bin/sh
2
3 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.mq =' >> $HGRCPATH
5
6 hg init repo
7 cd repo
8
9 echo foo > foo
10 hg ci -qAm 'add a file'
11
12 hg qinit
13
14 hg qnew foo
15 echo foo >> foo
16 hg qrefresh -m 'append foo'
17
18 hg qnew bar
19 echo bar >> foo
20 hg qrefresh -m 'append bar'
21
22 echo '% try to commit on top of a patch'
23 echo quux >> foo
24 hg ci -m 'append quux'
25
26 # cheat a bit...
27 mv .hg/patches .hg/patches2
28 hg ci -m 'append quux'
29 mv .hg/patches2 .hg/patches
30
31 echo '% qpop/qrefresh on the wrong revision'
32 hg qpop
33 hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/'
34 hg qrefresh
35
36 hg up -C qtip
37 echo '% qpop'
38 hg qpop
39
40 echo '% qrefresh'
41 hg qrefresh
42
43 echo '% tip:'
44 hg tip --template '#rev# #desc#\n'
@@ -0,0 +1,14 b''
1 % try to commit on top of a patch
2 abort: cannot commit over an applied mq patch
3 % qpop/qrefresh on the wrong revision
4 abort: working directory revision is not qtip
5 using patch queue:
6 abort: popping would remove a revision not managed by this patch queue
7 abort: working directory revision is not qtip
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 % qpop
10 abort: popping would remove a revision not managed by this patch queue
11 % qrefresh
12 abort: cannot refresh a revision with children
13 % tip:
14 3 append quux
@@ -861,10 +861,16 b' class queue:'
861 861 start = info[0]
862 862 rev = revlog.bin(info[1])
863 863
864 if update:
865 top = self.check_toppatch(repo)
866
867 if repo.changelog.heads(rev) != [revlog.bin(self.applied[-1].rev)]:
868 raise util.Abort("popping would remove a revision not "
869 "managed by this patch queue")
870
864 871 # we know there are no local changes, so we can make a simplified
865 872 # form of hg.update.
866 873 if update:
867 top = self.check_toppatch(repo)
868 874 qp = self.qparents(repo, rev)
869 875 changes = repo.changelog.read(qp)
870 876 mmap = repo.manifest.read(changes[0])
@@ -915,6 +921,8 b' class queue:'
915 921 self.check_toppatch(repo)
916 922 (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name)
917 923 top = revlog.bin(top)
924 if repo.changelog.heads(top) != [top]:
925 raise util.Abort("cannot refresh a revision with children")
918 926 cparents = repo.changelog.parents(top)
919 927 patchparent = self.qparents(repo, top)
920 928 message, comments, user, date, patchfound = self.readheaders(patchfn)
General Comments 0
You need to be logged in to leave comments. Login now