##// END OF EJS Templates
strip: improve full backup message
Matt Mackall -
r11200:12e5149c default
parent child Browse files
Show More
@@ -1,154 +1,154
1 # repair.py - functions for repository repair for mercurial
1 # repair.py - functions for repository repair for mercurial
2 #
2 #
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
4 # Copyright 2007 Matt Mackall
4 # Copyright 2007 Matt Mackall
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 import changegroup
9 import changegroup
10 from node import nullrev, short
10 from node import nullrev, short
11 from i18n import _
11 from i18n import _
12 import os
12 import os
13
13
14 def _bundle(repo, bases, heads, node, suffix, extranodes=None):
14 def _bundle(repo, bases, heads, node, suffix, extranodes=None):
15 """create a bundle with the specified revisions as a backup"""
15 """create a bundle with the specified revisions as a backup"""
16 cg = repo.changegroupsubset(bases, heads, 'strip', extranodes)
16 cg = repo.changegroupsubset(bases, heads, 'strip', extranodes)
17 backupdir = repo.join("strip-backup")
17 backupdir = repo.join("strip-backup")
18 if not os.path.isdir(backupdir):
18 if not os.path.isdir(backupdir):
19 os.mkdir(backupdir)
19 os.mkdir(backupdir)
20 name = os.path.join(backupdir, "%s-%s" % (short(node), suffix))
20 name = os.path.join(backupdir, "%s-%s" % (short(node), suffix))
21 return changegroup.writebundle(cg, name, "HG10BZ")
21 return changegroup.writebundle(cg, name, "HG10BZ")
22
22
23 def _collectfiles(repo, striprev):
23 def _collectfiles(repo, striprev):
24 """find out the filelogs affected by the strip"""
24 """find out the filelogs affected by the strip"""
25 files = set()
25 files = set()
26
26
27 for x in xrange(striprev, len(repo)):
27 for x in xrange(striprev, len(repo)):
28 files.update(repo[x].files())
28 files.update(repo[x].files())
29
29
30 return sorted(files)
30 return sorted(files)
31
31
32 def _collectextranodes(repo, files, link):
32 def _collectextranodes(repo, files, link):
33 """return the nodes that have to be saved before the strip"""
33 """return the nodes that have to be saved before the strip"""
34 def collectone(revlog):
34 def collectone(revlog):
35 extra = []
35 extra = []
36 startrev = count = len(revlog)
36 startrev = count = len(revlog)
37 # find the truncation point of the revlog
37 # find the truncation point of the revlog
38 for i in xrange(count):
38 for i in xrange(count):
39 lrev = revlog.linkrev(i)
39 lrev = revlog.linkrev(i)
40 if lrev >= link:
40 if lrev >= link:
41 startrev = i + 1
41 startrev = i + 1
42 break
42 break
43
43
44 # see if any revision after that point has a linkrev less than link
44 # see if any revision after that point has a linkrev less than link
45 # (we have to manually save these guys)
45 # (we have to manually save these guys)
46 for i in xrange(startrev, count):
46 for i in xrange(startrev, count):
47 node = revlog.node(i)
47 node = revlog.node(i)
48 lrev = revlog.linkrev(i)
48 lrev = revlog.linkrev(i)
49 if lrev < link:
49 if lrev < link:
50 extra.append((node, cl.node(lrev)))
50 extra.append((node, cl.node(lrev)))
51
51
52 return extra
52 return extra
53
53
54 extranodes = {}
54 extranodes = {}
55 cl = repo.changelog
55 cl = repo.changelog
56 extra = collectone(repo.manifest)
56 extra = collectone(repo.manifest)
57 if extra:
57 if extra:
58 extranodes[1] = extra
58 extranodes[1] = extra
59 for fname in files:
59 for fname in files:
60 f = repo.file(fname)
60 f = repo.file(fname)
61 extra = collectone(f)
61 extra = collectone(f)
62 if extra:
62 if extra:
63 extranodes[fname] = extra
63 extranodes[fname] = extra
64
64
65 return extranodes
65 return extranodes
66
66
67 def strip(ui, repo, node, backup="all"):
67 def strip(ui, repo, node, backup="all"):
68 cl = repo.changelog
68 cl = repo.changelog
69 # TODO delete the undo files, and handle undo of merge sets
69 # TODO delete the undo files, and handle undo of merge sets
70 striprev = cl.rev(node)
70 striprev = cl.rev(node)
71
71
72 # Some revisions with rev > striprev may not be descendants of striprev.
72 # Some revisions with rev > striprev may not be descendants of striprev.
73 # We have to find these revisions and put them in a bundle, so that
73 # We have to find these revisions and put them in a bundle, so that
74 # we can restore them after the truncations.
74 # we can restore them after the truncations.
75 # To create the bundle we use repo.changegroupsubset which requires
75 # To create the bundle we use repo.changegroupsubset which requires
76 # the list of heads and bases of the set of interesting revisions.
76 # the list of heads and bases of the set of interesting revisions.
77 # (head = revision in the set that has no descendant in the set;
77 # (head = revision in the set that has no descendant in the set;
78 # base = revision in the set that has no ancestor in the set)
78 # base = revision in the set that has no ancestor in the set)
79 tostrip = set((striprev,))
79 tostrip = set((striprev,))
80 saveheads = set()
80 saveheads = set()
81 savebases = []
81 savebases = []
82 for r in xrange(striprev + 1, len(cl)):
82 for r in xrange(striprev + 1, len(cl)):
83 parents = cl.parentrevs(r)
83 parents = cl.parentrevs(r)
84 if parents[0] in tostrip or parents[1] in tostrip:
84 if parents[0] in tostrip or parents[1] in tostrip:
85 # r is a descendant of striprev
85 # r is a descendant of striprev
86 tostrip.add(r)
86 tostrip.add(r)
87 # if this is a merge and one of the parents does not descend
87 # if this is a merge and one of the parents does not descend
88 # from striprev, mark that parent as a savehead.
88 # from striprev, mark that parent as a savehead.
89 if parents[1] != nullrev:
89 if parents[1] != nullrev:
90 for p in parents:
90 for p in parents:
91 if p not in tostrip and p > striprev:
91 if p not in tostrip and p > striprev:
92 saveheads.add(p)
92 saveheads.add(p)
93 else:
93 else:
94 # if no parents of this revision will be stripped, mark it as
94 # if no parents of this revision will be stripped, mark it as
95 # a savebase
95 # a savebase
96 if parents[0] < striprev and parents[1] < striprev:
96 if parents[0] < striprev and parents[1] < striprev:
97 savebases.append(cl.node(r))
97 savebases.append(cl.node(r))
98
98
99 saveheads.difference_update(parents)
99 saveheads.difference_update(parents)
100 saveheads.add(r)
100 saveheads.add(r)
101
101
102 saveheads = [cl.node(r) for r in saveheads]
102 saveheads = [cl.node(r) for r in saveheads]
103 files = _collectfiles(repo, striprev)
103 files = _collectfiles(repo, striprev)
104
104
105 extranodes = _collectextranodes(repo, files, striprev)
105 extranodes = _collectextranodes(repo, files, striprev)
106
106
107 # create a changegroup for all the branches we need to keep
107 # create a changegroup for all the branches we need to keep
108 backupfile = None
108 backupfile = None
109 if backup == "all":
109 if backup == "all":
110 backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
110 backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
111 repo.ui.status(_("saving bundle to %s\n") % backupfile)
111 repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
112 if saveheads or extranodes:
112 if saveheads or extranodes:
113 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
113 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
114 extranodes)
114 extranodes)
115
115
116 mfst = repo.manifest
116 mfst = repo.manifest
117
117
118 tr = repo.transaction("strip")
118 tr = repo.transaction("strip")
119 offset = len(tr.entries)
119 offset = len(tr.entries)
120
120
121 try:
121 try:
122 tr.startgroup()
122 tr.startgroup()
123 cl.strip(striprev, tr)
123 cl.strip(striprev, tr)
124 mfst.strip(striprev, tr)
124 mfst.strip(striprev, tr)
125 for fn in files:
125 for fn in files:
126 repo.file(fn).strip(striprev, tr)
126 repo.file(fn).strip(striprev, tr)
127 tr.endgroup()
127 tr.endgroup()
128
128
129 try:
129 try:
130 for i in xrange(offset, len(tr.entries)):
130 for i in xrange(offset, len(tr.entries)):
131 file, troffset, ignore = tr.entries[i]
131 file, troffset, ignore = tr.entries[i]
132 repo.sopener(file, 'a').truncate(troffset)
132 repo.sopener(file, 'a').truncate(troffset)
133 tr.close()
133 tr.close()
134 except:
134 except:
135 tr.abort()
135 tr.abort()
136 raise
136 raise
137
137
138 if saveheads or extranodes:
138 if saveheads or extranodes:
139 ui.status(_("adding branch\n"))
139 ui.status(_("adding branch\n"))
140 f = open(chgrpfile, "rb")
140 f = open(chgrpfile, "rb")
141 gen = changegroup.readbundle(f, chgrpfile)
141 gen = changegroup.readbundle(f, chgrpfile)
142 repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile, True)
142 repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile, True)
143 f.close()
143 f.close()
144 if backup != "strip":
144 if backup != "strip":
145 os.unlink(chgrpfile)
145 os.unlink(chgrpfile)
146 except:
146 except:
147 if backupfile:
147 if backupfile:
148 ui.warn("strip failed, full bundle stored in '%s'\n" % backupfile)
148 ui.warn("strip failed, full bundle stored in '%s'\n" % backupfile)
149 elif saveheads:
149 elif saveheads:
150 ui.warn("strip failed, partial bundle stored in '%s'\n"
150 ui.warn("strip failed, partial bundle stored in '%s'\n"
151 % chgrpfile)
151 % chgrpfile)
152 raise
152 raise
153
153
154 repo.destroyed()
154 repo.destroyed()
@@ -1,17 +1,17
1 #/bin/sh
1 #/bin/sh
2
2
3 hideport() { sed "s/localhost:$HGPORT/localhost:\$HGPORT/"; }
3 hideport() { sed "s/localhost:$HGPORT/localhost:\$HGPORT/"; }
4
4
5 repr() { python -c "import sys; print repr(sys.stdin.read()).replace('\\n', '\n')"; }
5 repr() { python -c "import sys; print repr(sys.stdin.read()).replace('\\n', '\n')"; }
6
6
7 hidehex() { python -c 'import sys, re; print re.replace("\b[0-9A-Fa-f]{12,40}", "X" * 12)'; }
7 hidehex() { python -c 'import sys, re; print re.replace("\b[0-9A-Fa-f]{12,40}", "X" * 12)'; }
8
8
9 hidetmp() { sed "s/$HGTMP/\$HGTMP/"; }
9 hidetmp() { sed "s/$HGTMP/\$HGTMP/"; }
10
10
11 hidebackup() { sed 's/\(saving bundle to \).*/\1/'; }
11 hidebackup() { sed 's/\(saved backup bundle to \).*/\1/'; }
12
12
13 cleanrebase() {
13 cleanrebase() {
14 sed -e 's/\(Rebase status stored to\).*/\1/' \
14 sed -e 's/\(Rebase status stored to\).*/\1/' \
15 -e 's/\(Rebase status restored from\).*/\1/' \
15 -e 's/\(Rebase status restored from\).*/\1/' \
16 -e 's/\(saving bundle to \).*/\1/';
16 -e 's/\(saved backup bundle to \).*/\1/';
17 }
17 }
@@ -1,44 +1,45
1 #!/bin/sh
1 #!/bin/sh
2
2
3 source $TESTDIR/helpers.sh
3 echo "[extensions]" >> $HGRCPATH
4 echo "[extensions]" >> $HGRCPATH
4 echo "bookmarks=" >> $HGRCPATH
5 echo "bookmarks=" >> $HGRCPATH
5 echo "mq=" >> $HGRCPATH
6 echo "mq=" >> $HGRCPATH
6
7
7 hg init
8 hg init
8
9
9 echo qqq>qqq.txt
10 echo qqq>qqq.txt
10
11
11 echo % add file
12 echo % add file
12 hg add
13 hg add
13
14
14 echo % commit first revision
15 echo % commit first revision
15 hg ci -m 1 -u user -d "1 0"
16 hg ci -m 1 -u user -d "1 0"
16
17
17 echo % set bookmark
18 echo % set bookmark
18 hg book test
19 hg book test
19
20
20 echo www>>qqq.txt
21 echo www>>qqq.txt
21
22
22 echo % commit second revision
23 echo % commit second revision
23 hg ci -m 2 -u usr -d "1 0"
24 hg ci -m 2 -u usr -d "1 0"
24
25
25 echo % set bookmark
26 echo % set bookmark
26 hg book test2
27 hg book test2
27
28
28 echo % update to -2
29 echo % update to -2
29 hg update -r -2
30 hg update -r -2
30
31
31 echo eee>>qqq.txt
32 echo eee>>qqq.txt
32
33
33 echo % commit new head
34 echo % commit new head
34 hg ci -m 3 -u user -d "1 0"
35 hg ci -m 3 -u user -d "1 0"
35
36
36 echo % bookmarks updated?
37 echo % bookmarks updated?
37 hg book
38 hg book
38
39
39 echo % strip to revision 1
40 echo % strip to revision 1
40 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
41 hg strip 1 | hidebackup
41
42
42 echo % list bookmarks
43 echo % list bookmarks
43 hg book
44 hg book
44
45
@@ -1,23 +1,23
1 % add file
1 % add file
2 adding qqq.txt
2 adding qqq.txt
3 % commit first revision
3 % commit first revision
4 % set bookmark
4 % set bookmark
5 % commit second revision
5 % commit second revision
6 % set bookmark
6 % set bookmark
7 % update to -2
7 % update to -2
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 % commit new head
9 % commit new head
10 created new head
10 created new head
11 % bookmarks updated?
11 % bookmarks updated?
12 test 1:16b24da7e457
12 test 1:16b24da7e457
13 test2 1:16b24da7e457
13 test2 1:16b24da7e457
14 % strip to revision 1
14 % strip to revision 1
15 saving bundle to
15 saved backup bundle to
16 adding branch
16 adding branch
17 adding changesets
17 adding changesets
18 adding manifests
18 adding manifests
19 adding file changes
19 adding file changes
20 added 1 changesets with 1 changes to 1 files
20 added 1 changesets with 1 changes to 1 files
21 % list bookmarks
21 % list bookmarks
22 * test 1:9f1b7e78eff8
22 * test 1:9f1b7e78eff8
23 * test2 1:9f1b7e78eff8
23 * test2 1:9f1b7e78eff8
@@ -1,620 +1,622
1 #!/bin/sh
1 #!/bin/sh
2
2
3 source $TESTDIR/helpers.sh
4
3 checkundo()
5 checkundo()
4 {
6 {
5 if [ -f .hg/store/undo ]; then
7 if [ -f .hg/store/undo ]; then
6 echo ".hg/store/undo still exists after $1"
8 echo ".hg/store/undo still exists after $1"
7 fi
9 fi
8 }
10 }
9
11
10 echo "[extensions]" >> $HGRCPATH
12 echo "[extensions]" >> $HGRCPATH
11 echo "mq=" >> $HGRCPATH
13 echo "mq=" >> $HGRCPATH
12
14
13 echo "[mq]" >> $HGRCPATH
15 echo "[mq]" >> $HGRCPATH
14 echo "plain=true" >> $HGRCPATH
16 echo "plain=true" >> $HGRCPATH
15
17
16 echo % help
18 echo % help
17 hg help mq
19 hg help mq
18
20
19 hg init a
21 hg init a
20 cd a
22 cd a
21 echo a > a
23 echo a > a
22 hg ci -Ama
24 hg ci -Ama
23
25
24 hg clone . ../k
26 hg clone . ../k
25
27
26 mkdir b
28 mkdir b
27 echo z > b/z
29 echo z > b/z
28 hg ci -Ama
30 hg ci -Ama
29
31
30 echo % qinit
32 echo % qinit
31
33
32 hg qinit
34 hg qinit
33
35
34 cd ..
36 cd ..
35 hg init b
37 hg init b
36
38
37 echo % -R qinit
39 echo % -R qinit
38
40
39 hg -R b qinit
41 hg -R b qinit
40
42
41 hg init c
43 hg init c
42
44
43 echo % qinit -c
45 echo % qinit -c
44
46
45 hg --cwd c qinit -c
47 hg --cwd c qinit -c
46 hg -R c/.hg/patches st
48 hg -R c/.hg/patches st
47
49
48 echo '% qinit; qinit -c'
50 echo '% qinit; qinit -c'
49 hg init d
51 hg init d
50 cd d
52 cd d
51 hg qinit
53 hg qinit
52 hg qinit -c
54 hg qinit -c
53 # qinit -c should create both files if they don't exist
55 # qinit -c should create both files if they don't exist
54 echo ' .hgignore:'
56 echo ' .hgignore:'
55 cat .hg/patches/.hgignore
57 cat .hg/patches/.hgignore
56 echo ' series:'
58 echo ' series:'
57 cat .hg/patches/series
59 cat .hg/patches/series
58 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
60 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
59 cd ..
61 cd ..
60
62
61 echo '% qinit; <stuff>; qinit -c'
63 echo '% qinit; <stuff>; qinit -c'
62 hg init e
64 hg init e
63 cd e
65 cd e
64 hg qnew A
66 hg qnew A
65 checkundo qnew
67 checkundo qnew
66 echo foo > foo
68 echo foo > foo
67 hg add foo
69 hg add foo
68 hg qrefresh
70 hg qrefresh
69 hg qnew B
71 hg qnew B
70 echo >> foo
72 echo >> foo
71 hg qrefresh
73 hg qrefresh
72 echo status >> .hg/patches/.hgignore
74 echo status >> .hg/patches/.hgignore
73 echo bleh >> .hg/patches/.hgignore
75 echo bleh >> .hg/patches/.hgignore
74 hg qinit -c
76 hg qinit -c
75 hg -R .hg/patches status
77 hg -R .hg/patches status
76 # qinit -c shouldn't touch these files if they already exist
78 # qinit -c shouldn't touch these files if they already exist
77 echo ' .hgignore:'
79 echo ' .hgignore:'
78 cat .hg/patches/.hgignore
80 cat .hg/patches/.hgignore
79 echo ' series:'
81 echo ' series:'
80 cat .hg/patches/series
82 cat .hg/patches/series
81 cd ..
83 cd ..
82
84
83 echo '% init --mq without repo'
85 echo '% init --mq without repo'
84 mkdir f
86 mkdir f
85 cd f
87 cd f
86 hg init --mq
88 hg init --mq
87 cd ..
89 cd ..
88
90
89 echo '% init --mq with repo path'
91 echo '% init --mq with repo path'
90 hg init g
92 hg init g
91 hg init --mq g
93 hg init --mq g
92 test -d g/.hg/patches/.hg && echo "ok" || echo "failed"
94 test -d g/.hg/patches/.hg && echo "ok" || echo "failed"
93
95
94 echo '% init --mq with nonexistent directory'
96 echo '% init --mq with nonexistent directory'
95 hg init --mq nonexistentdir
97 hg init --mq nonexistentdir
96
98
97 echo '% init --mq with bundle (non "local")'
99 echo '% init --mq with bundle (non "local")'
98 hg -R a bundle --all a.bundle >/dev/null
100 hg -R a bundle --all a.bundle >/dev/null
99 hg init --mq a.bundle
101 hg init --mq a.bundle
100
102
101 cd a
103 cd a
102
104
103 hg qnew -m 'foo bar' test.patch
105 hg qnew -m 'foo bar' test.patch
104
106
105 echo % qrefresh
107 echo % qrefresh
106
108
107 echo a >> a
109 echo a >> a
108 hg qrefresh
110 hg qrefresh
109 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
111 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
110 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
112 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
111 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
113 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
112
114
113 echo % empty qrefresh
115 echo % empty qrefresh
114
116
115 hg qrefresh -X a
117 hg qrefresh -X a
116 echo 'revision:'
118 echo 'revision:'
117 hg diff -r -2 -r -1
119 hg diff -r -2 -r -1
118 echo 'patch:'
120 echo 'patch:'
119 cat .hg/patches/test.patch
121 cat .hg/patches/test.patch
120 echo 'working dir diff:'
122 echo 'working dir diff:'
121 hg diff --nodates -q
123 hg diff --nodates -q
122 # restore things
124 # restore things
123 hg qrefresh
125 hg qrefresh
124 checkundo qrefresh
126 checkundo qrefresh
125
127
126 echo % qpop
128 echo % qpop
127
129
128 hg qpop
130 hg qpop
129 checkundo qpop
131 checkundo qpop
130
132
131 echo % qpush with dump of tag cache
133 echo % qpush with dump of tag cache
132
134
133 # Dump the tag cache to ensure that it has exactly one head after qpush.
135 # Dump the tag cache to ensure that it has exactly one head after qpush.
134 rm -f .hg/tags.cache
136 rm -f .hg/tags.cache
135 hg tags > /dev/null
137 hg tags > /dev/null
136 echo ".hg/tags.cache (pre qpush):"
138 echo ".hg/tags.cache (pre qpush):"
137 sed 's/ [0-9a-f]*//' .hg/tags.cache
139 sed 's/ [0-9a-f]*//' .hg/tags.cache
138 hg qpush
140 hg qpush
139 hg tags > /dev/null
141 hg tags > /dev/null
140 echo ".hg/tags.cache (post qpush):"
142 echo ".hg/tags.cache (post qpush):"
141 sed 's/ [0-9a-f]*//' .hg/tags.cache
143 sed 's/ [0-9a-f]*//' .hg/tags.cache
142
144
143 checkundo qpush
145 checkundo qpush
144
146
145 cd ..
147 cd ..
146
148
147 echo % pop/push outside repo
149 echo % pop/push outside repo
148
150
149 hg -R a qpop
151 hg -R a qpop
150 hg -R a qpush
152 hg -R a qpush
151
153
152 cd a
154 cd a
153 hg qnew test2.patch
155 hg qnew test2.patch
154
156
155 echo % qrefresh in subdir
157 echo % qrefresh in subdir
156
158
157 cd b
159 cd b
158 echo a > a
160 echo a > a
159 hg add a
161 hg add a
160 hg qrefresh
162 hg qrefresh
161
163
162 echo % pop/push -a in subdir
164 echo % pop/push -a in subdir
163
165
164 hg qpop -a
166 hg qpop -a
165 hg --traceback qpush -a
167 hg --traceback qpush -a
166
168
167 # setting columns & interactive tests truncating (issue1912)
169 # setting columns & interactive tests truncating (issue1912)
168 echo % qseries
170 echo % qseries
169 COLUMNS=4 hg qseries --config ui.interactive=true
171 COLUMNS=4 hg qseries --config ui.interactive=true
170 COLUMNS=20 hg qseries --config ui.interactive=true -vs
172 COLUMNS=20 hg qseries --config ui.interactive=true -vs
171 hg qpop
173 hg qpop
172 hg qseries -vs
174 hg qseries -vs
173 hg sum | grep mq
175 hg sum | grep mq
174 hg qpush
176 hg qpush
175 hg sum | grep mq
177 hg sum | grep mq
176
178
177 echo % qapplied
179 echo % qapplied
178 hg qapplied
180 hg qapplied
179
181
180 echo % qtop
182 echo % qtop
181 hg qtop
183 hg qtop
182
184
183 echo % prev
185 echo % prev
184 hg qapp -1
186 hg qapp -1
185
187
186 echo % next
188 echo % next
187 hg qunapp -1
189 hg qunapp -1
188
190
189 hg qpop
191 hg qpop
190 echo % commit should fail
192 echo % commit should fail
191 hg commit
193 hg commit
192
194
193 echo % push should fail
195 echo % push should fail
194 hg push ../../k
196 hg push ../../k
195
197
196 echo % import should fail
198 echo % import should fail
197 hg st .
199 hg st .
198 echo foo >> ../a
200 echo foo >> ../a
199 hg diff > ../../import.diff
201 hg diff > ../../import.diff
200 hg revert --no-backup ../a
202 hg revert --no-backup ../a
201 hg import ../../import.diff
203 hg import ../../import.diff
202 hg st
204 hg st
203 echo % import --no-commit should succeed
205 echo % import --no-commit should succeed
204 hg import --no-commit ../../import.diff
206 hg import --no-commit ../../import.diff
205 hg st
207 hg st
206 hg revert --no-backup ../a
208 hg revert --no-backup ../a
207
209
208 echo % qunapplied
210 echo % qunapplied
209 hg qunapplied
211 hg qunapplied
210
212
211 echo % qpush/qpop with index
213 echo % qpush/qpop with index
212 hg qnew test1b.patch
214 hg qnew test1b.patch
213 echo 1b > 1b
215 echo 1b > 1b
214 hg add 1b
216 hg add 1b
215 hg qrefresh
217 hg qrefresh
216 hg qpush 2
218 hg qpush 2
217 hg qpop 0
219 hg qpop 0
218 hg qpush test.patch+1
220 hg qpush test.patch+1
219 hg qpush test.patch+2
221 hg qpush test.patch+2
220 hg qpop test2.patch-1
222 hg qpop test2.patch-1
221 hg qpop test2.patch-2
223 hg qpop test2.patch-2
222 hg qpush test1b.patch+1
224 hg qpush test1b.patch+1
223
225
224 echo % qpush --move
226 echo % qpush --move
225 hg qpop -a
227 hg qpop -a
226 hg qpush --move test2.patch # move to front
228 hg qpush --move test2.patch # move to front
227 hg qpush --move test1b.patch
229 hg qpush --move test1b.patch
228 hg qpush --move test.patch # noop move
230 hg qpush --move test.patch # noop move
229 hg qseries -v
231 hg qseries -v
230 hg qpop -a
232 hg qpop -a
231 hg qpush --move test.patch # cleaning up
233 hg qpush --move test.patch # cleaning up
232 hg qpush --move test1b.patch
234 hg qpush --move test1b.patch
233 hg qpush --move bogus # nonexistent patch
235 hg qpush --move bogus # nonexistent patch
234 hg qpush --move test.patch # already applied
236 hg qpush --move test.patch # already applied
235 hg qpush
237 hg qpush
236
238
237 echo % pop, qapplied, qunapplied
239 echo % pop, qapplied, qunapplied
238 hg qseries -v
240 hg qseries -v
239 echo % qapplied -1 test.patch
241 echo % qapplied -1 test.patch
240 hg qapplied -1 test.patch
242 hg qapplied -1 test.patch
241 echo % qapplied -1 test1b.patch
243 echo % qapplied -1 test1b.patch
242 hg qapplied -1 test1b.patch
244 hg qapplied -1 test1b.patch
243 echo % qapplied -1 test2.patch
245 echo % qapplied -1 test2.patch
244 hg qapplied -1 test2.patch
246 hg qapplied -1 test2.patch
245 echo % qapplied -1
247 echo % qapplied -1
246 hg qapplied -1
248 hg qapplied -1
247 echo % qapplied
249 echo % qapplied
248 hg qapplied
250 hg qapplied
249 echo % qapplied test1b.patch
251 echo % qapplied test1b.patch
250 hg qapplied test1b.patch
252 hg qapplied test1b.patch
251 echo % qunapplied -1
253 echo % qunapplied -1
252 hg qunapplied -1
254 hg qunapplied -1
253 echo % qunapplied
255 echo % qunapplied
254 hg qunapplied
256 hg qunapplied
255 echo % popping
257 echo % popping
256 hg qpop
258 hg qpop
257 echo % qunapplied -1
259 echo % qunapplied -1
258 hg qunapplied -1
260 hg qunapplied -1
259 echo % qunapplied
261 echo % qunapplied
260 hg qunapplied
262 hg qunapplied
261 echo % qunapplied test2.patch
263 echo % qunapplied test2.patch
262 hg qunapplied test2.patch
264 hg qunapplied test2.patch
263 echo % qunapplied -1 test2.patch
265 echo % qunapplied -1 test2.patch
264 hg qunapplied -1 test2.patch
266 hg qunapplied -1 test2.patch
265 echo % popping -a
267 echo % popping -a
266 hg qpop -a
268 hg qpop -a
267 echo % qapplied
269 echo % qapplied
268 hg qapplied
270 hg qapplied
269 echo % qapplied -1
271 echo % qapplied -1
270 hg qapplied -1
272 hg qapplied -1
271 hg qpush
273 hg qpush
272
274
273 echo % push should succeed
275 echo % push should succeed
274 hg qpop -a
276 hg qpop -a
275 hg push ../../k
277 hg push ../../k
276
278
277 echo % qpush/qpop error codes
279 echo % qpush/qpop error codes
278 errorcode()
280 errorcode()
279 {
281 {
280 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
282 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
281 }
283 }
282
284
283 # we want to start with some patches applied
285 # we want to start with some patches applied
284 hg qpush -a
286 hg qpush -a
285 echo " % pops all patches and succeeds"
287 echo " % pops all patches and succeeds"
286 errorcode qpop -a
288 errorcode qpop -a
287 echo " % does nothing and succeeds"
289 echo " % does nothing and succeeds"
288 errorcode qpop -a
290 errorcode qpop -a
289 echo " % fails - nothing else to pop"
291 echo " % fails - nothing else to pop"
290 errorcode qpop
292 errorcode qpop
291 echo " % pushes a patch and succeeds"
293 echo " % pushes a patch and succeeds"
292 errorcode qpush
294 errorcode qpush
293 echo " % pops a patch and succeeds"
295 echo " % pops a patch and succeeds"
294 errorcode qpop
296 errorcode qpop
295 echo " % pushes up to test1b.patch and succeeds"
297 echo " % pushes up to test1b.patch and succeeds"
296 errorcode qpush test1b.patch
298 errorcode qpush test1b.patch
297 echo " % does nothing and succeeds"
299 echo " % does nothing and succeeds"
298 errorcode qpush test1b.patch
300 errorcode qpush test1b.patch
299 echo " % does nothing and succeeds"
301 echo " % does nothing and succeeds"
300 errorcode qpop test1b.patch
302 errorcode qpop test1b.patch
301 echo " % fails - can't push to this patch"
303 echo " % fails - can't push to this patch"
302 errorcode qpush test.patch
304 errorcode qpush test.patch
303 echo " % fails - can't pop to this patch"
305 echo " % fails - can't pop to this patch"
304 errorcode qpop test2.patch
306 errorcode qpop test2.patch
305 echo " % pops up to test.patch and succeeds"
307 echo " % pops up to test.patch and succeeds"
306 errorcode qpop test.patch
308 errorcode qpop test.patch
307 echo " % pushes all patches and succeeds"
309 echo " % pushes all patches and succeeds"
308 errorcode qpush -a
310 errorcode qpush -a
309 echo " % does nothing and succeeds"
311 echo " % does nothing and succeeds"
310 errorcode qpush -a
312 errorcode qpush -a
311 echo " % fails - nothing else to push"
313 echo " % fails - nothing else to push"
312 errorcode qpush
314 errorcode qpush
313 echo " % does nothing and succeeds"
315 echo " % does nothing and succeeds"
314 errorcode qpush test2.patch
316 errorcode qpush test2.patch
315
317
316
318
317 echo % strip
319 echo % strip
318 cd ../../b
320 cd ../../b
319 echo x>x
321 echo x>x
320 hg ci -Ama
322 hg ci -Ama
321 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
323 hg strip tip | hidebackup
322 hg unbundle .hg/strip-backup/*
324 hg unbundle .hg/strip-backup/*
323
325
324 echo % strip with local changes, should complain
326 echo % strip with local changes, should complain
325 hg up
327 hg up
326 echo y>y
328 echo y>y
327 hg add y
329 hg add y
328 hg strip tip | sed 's/\(saving bundle to \).*/\1/'
330 hg strip tip | hidebackup
329 echo % --force strip with local changes
331 echo % --force strip with local changes
330 hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
332 hg strip -f tip | hidebackup
331
333
332 echo '% cd b; hg qrefresh'
334 echo '% cd b; hg qrefresh'
333 hg init refresh
335 hg init refresh
334 cd refresh
336 cd refresh
335 echo a > a
337 echo a > a
336 hg ci -Ama
338 hg ci -Ama
337 hg qnew -mfoo foo
339 hg qnew -mfoo foo
338 echo a >> a
340 echo a >> a
339 hg qrefresh
341 hg qrefresh
340 mkdir b
342 mkdir b
341 cd b
343 cd b
342 echo f > f
344 echo f > f
343 hg add f
345 hg add f
344 hg qrefresh
346 hg qrefresh
345 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
347 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
346 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
348 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
347 echo % hg qrefresh .
349 echo % hg qrefresh .
348 hg qrefresh .
350 hg qrefresh .
349 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
351 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
350 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
352 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
351 hg status
353 hg status
352
354
353 echo % qpush failure
355 echo % qpush failure
354 cd ..
356 cd ..
355 hg qrefresh
357 hg qrefresh
356 hg qnew -mbar bar
358 hg qnew -mbar bar
357 echo foo > foo
359 echo foo > foo
358 echo bar > bar
360 echo bar > bar
359 hg add foo bar
361 hg add foo bar
360 hg qrefresh
362 hg qrefresh
361 hg qpop -a
363 hg qpop -a
362 echo bar > foo
364 echo bar > foo
363 hg qpush -a
365 hg qpush -a
364 hg st
366 hg st
365
367
366 echo % mq tags
368 echo % mq tags
367 hg log --template '{rev} {tags}\n' -r qparent:qtip
369 hg log --template '{rev} {tags}\n' -r qparent:qtip
368
370
369 echo % bad node in status
371 echo % bad node in status
370 hg qpop
372 hg qpop
371 hg strip -qn tip
373 hg strip -qn tip
372 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
374 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
373 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
375 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
374 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
376 hg qpop 2>&1 | sed -e 's/unknown node .*/unknown node/'
375
377
376 cat >>$HGRCPATH <<EOF
378 cat >>$HGRCPATH <<EOF
377 [diff]
379 [diff]
378 git = True
380 git = True
379 EOF
381 EOF
380 cd ..
382 cd ..
381 hg init git
383 hg init git
382 cd git
384 cd git
383 hg qinit
385 hg qinit
384
386
385 hg qnew -m'new file' new
387 hg qnew -m'new file' new
386 echo foo > new
388 echo foo > new
387 chmod +x new
389 chmod +x new
388 hg add new
390 hg add new
389 hg qrefresh
391 hg qrefresh
390 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
392 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
391 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
393 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
392
394
393 hg qnew -m'copy file' copy
395 hg qnew -m'copy file' copy
394 hg cp new copy
396 hg cp new copy
395 hg qrefresh
397 hg qrefresh
396 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
398 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
397 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
399 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
398
400
399 hg qpop
401 hg qpop
400 hg qpush
402 hg qpush
401 hg qdiff
403 hg qdiff
402 cat >>$HGRCPATH <<EOF
404 cat >>$HGRCPATH <<EOF
403 [diff]
405 [diff]
404 git = False
406 git = False
405 EOF
407 EOF
406 hg qdiff --git
408 hg qdiff --git
407 cd ..
409 cd ..
408
410
409 echo % test file addition in slow path
411 echo % test file addition in slow path
410 hg init slow
412 hg init slow
411 cd slow
413 cd slow
412 hg qinit
414 hg qinit
413 echo foo > foo
415 echo foo > foo
414 hg add foo
416 hg add foo
415 hg ci -m 'add foo'
417 hg ci -m 'add foo'
416 hg qnew bar
418 hg qnew bar
417 echo bar > bar
419 echo bar > bar
418 hg add bar
420 hg add bar
419 hg mv foo baz
421 hg mv foo baz
420 hg qrefresh --git
422 hg qrefresh --git
421 hg up -C 0
423 hg up -C 0
422 echo >> foo
424 echo >> foo
423 hg ci -m 'change foo'
425 hg ci -m 'change foo'
424 hg up -C 1
426 hg up -C 1
425 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
427 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
426 cat .hg/patches/bar
428 cat .hg/patches/bar
427 hg log -v --template '{rev} {file_copies}\n' -r .
429 hg log -v --template '{rev} {file_copies}\n' -r .
428 hg qrefresh --git
430 hg qrefresh --git
429 cat .hg/patches/bar
431 cat .hg/patches/bar
430 hg log -v --template '{rev} {file_copies}\n' -r .
432 hg log -v --template '{rev} {file_copies}\n' -r .
431 hg qrefresh
433 hg qrefresh
432 grep 'diff --git' .hg/patches/bar
434 grep 'diff --git' .hg/patches/bar
433
435
434 echo % test file move chains in the slow path
436 echo % test file move chains in the slow path
435 hg up -C 1
437 hg up -C 1
436 echo >> foo
438 echo >> foo
437 hg ci -m 'change foo again'
439 hg ci -m 'change foo again'
438 hg up -C 2
440 hg up -C 2
439 hg mv bar quux
441 hg mv bar quux
440 hg mv baz bleh
442 hg mv baz bleh
441 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
443 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
442 cat .hg/patches/bar
444 cat .hg/patches/bar
443 hg log -v --template '{rev} {file_copies}\n' -r .
445 hg log -v --template '{rev} {file_copies}\n' -r .
444 hg mv quux fred
446 hg mv quux fred
445 hg mv bleh barney
447 hg mv bleh barney
446 hg qrefresh --git
448 hg qrefresh --git
447 cat .hg/patches/bar
449 cat .hg/patches/bar
448 hg log -v --template '{rev} {file_copies}\n' -r .
450 hg log -v --template '{rev} {file_copies}\n' -r .
449
451
450 echo % refresh omitting an added file
452 echo % refresh omitting an added file
451 hg qnew baz
453 hg qnew baz
452 echo newfile > newfile
454 echo newfile > newfile
453 hg add newfile
455 hg add newfile
454 hg qrefresh
456 hg qrefresh
455 hg st -A newfile
457 hg st -A newfile
456 hg qrefresh -X newfile
458 hg qrefresh -X newfile
457 hg st -A newfile
459 hg st -A newfile
458 hg revert newfile
460 hg revert newfile
459 rm newfile
461 rm newfile
460 hg qpop
462 hg qpop
461 hg qdel baz
463 hg qdel baz
462
464
463 echo % create a git patch
465 echo % create a git patch
464 echo a > alexander
466 echo a > alexander
465 hg add alexander
467 hg add alexander
466 hg qnew -f --git addalexander
468 hg qnew -f --git addalexander
467 grep diff .hg/patches/addalexander
469 grep diff .hg/patches/addalexander
468
470
469 echo % create a git binary patch
471 echo % create a git binary patch
470 cat > writebin.py <<EOF
472 cat > writebin.py <<EOF
471 import sys
473 import sys
472 path = sys.argv[1]
474 path = sys.argv[1]
473 open(path, 'wb').write('BIN\x00ARY')
475 open(path, 'wb').write('BIN\x00ARY')
474 EOF
476 EOF
475 python writebin.py bucephalus
477 python writebin.py bucephalus
476
478
477 python "$TESTDIR/md5sum.py" bucephalus
479 python "$TESTDIR/md5sum.py" bucephalus
478 hg add bucephalus
480 hg add bucephalus
479 hg qnew -f --git addbucephalus
481 hg qnew -f --git addbucephalus
480 grep diff .hg/patches/addbucephalus
482 grep diff .hg/patches/addbucephalus
481
483
482 echo % check binary patches can be popped and pushed
484 echo % check binary patches can be popped and pushed
483 hg qpop
485 hg qpop
484 test -f bucephalus && echo % bucephalus should not be there
486 test -f bucephalus && echo % bucephalus should not be there
485 hg qpush
487 hg qpush
486 test -f bucephalus || echo % bucephalus should be there
488 test -f bucephalus || echo % bucephalus should be there
487 python "$TESTDIR/md5sum.py" bucephalus
489 python "$TESTDIR/md5sum.py" bucephalus
488
490
489
491
490 echo '% strip again'
492 echo '% strip again'
491 cd ..
493 cd ..
492 hg init strip
494 hg init strip
493 cd strip
495 cd strip
494 touch foo
496 touch foo
495 hg add foo
497 hg add foo
496 hg ci -m 'add foo'
498 hg ci -m 'add foo'
497 echo >> foo
499 echo >> foo
498 hg ci -m 'change foo 1'
500 hg ci -m 'change foo 1'
499 hg up -C 0
501 hg up -C 0
500 echo 1 >> foo
502 echo 1 >> foo
501 hg ci -m 'change foo 2'
503 hg ci -m 'change foo 2'
502 HGMERGE=true hg merge
504 HGMERGE=true hg merge
503 hg ci -m merge
505 hg ci -m merge
504 hg log
506 hg log
505 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
507 hg strip 1 | hidebackup
506 checkundo strip
508 checkundo strip
507 hg log
509 hg log
508 cd ..
510 cd ..
509
511
510 echo '% qclone'
512 echo '% qclone'
511 qlog()
513 qlog()
512 {
514 {
513 echo 'main repo:'
515 echo 'main repo:'
514 hg log --template ' rev {rev}: {desc}\n'
516 hg log --template ' rev {rev}: {desc}\n'
515 echo 'patch repo:'
517 echo 'patch repo:'
516 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
518 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
517 }
519 }
518 hg init qclonesource
520 hg init qclonesource
519 cd qclonesource
521 cd qclonesource
520 echo foo > foo
522 echo foo > foo
521 hg add foo
523 hg add foo
522 hg ci -m 'add foo'
524 hg ci -m 'add foo'
523 hg qinit
525 hg qinit
524 hg qnew patch1
526 hg qnew patch1
525 echo bar >> foo
527 echo bar >> foo
526 hg qrefresh -m 'change foo'
528 hg qrefresh -m 'change foo'
527 cd ..
529 cd ..
528
530
529 # repo with unversioned patch dir
531 # repo with unversioned patch dir
530 hg qclone qclonesource failure
532 hg qclone qclonesource failure
531
533
532 cd qclonesource
534 cd qclonesource
533 hg qinit -c
535 hg qinit -c
534 hg qci -m checkpoint
536 hg qci -m checkpoint
535 qlog
537 qlog
536 cd ..
538 cd ..
537
539
538 # repo with patches applied
540 # repo with patches applied
539 hg qclone qclonesource qclonedest
541 hg qclone qclonesource qclonedest
540 cd qclonedest
542 cd qclonedest
541 qlog
543 qlog
542 cd ..
544 cd ..
543
545
544 # repo with patches unapplied
546 # repo with patches unapplied
545 cd qclonesource
547 cd qclonesource
546 hg qpop -a
548 hg qpop -a
547 qlog
549 qlog
548 cd ..
550 cd ..
549 hg qclone qclonesource qclonedest2
551 hg qclone qclonesource qclonedest2
550 cd qclonedest2
552 cd qclonedest2
551 qlog
553 qlog
552 cd ..
554 cd ..
553
555
554 echo % 'test applying on an empty file (issue 1033)'
556 echo % 'test applying on an empty file (issue 1033)'
555 hg init empty
557 hg init empty
556 cd empty
558 cd empty
557 touch a
559 touch a
558 hg ci -Am addempty
560 hg ci -Am addempty
559 echo a > a
561 echo a > a
560 hg qnew -f -e changea
562 hg qnew -f -e changea
561 hg qpop
563 hg qpop
562 hg qpush
564 hg qpush
563 cd ..
565 cd ..
564
566
565 echo % test qpush with --force, issue1087
567 echo % test qpush with --force, issue1087
566 hg init forcepush
568 hg init forcepush
567 cd forcepush
569 cd forcepush
568 echo hello > hello.txt
570 echo hello > hello.txt
569 echo bye > bye.txt
571 echo bye > bye.txt
570 hg ci -Ama
572 hg ci -Ama
571 hg qnew -d '0 0' empty
573 hg qnew -d '0 0' empty
572 hg qpop
574 hg qpop
573 echo world >> hello.txt
575 echo world >> hello.txt
574
576
575 echo % qpush should fail, local changes
577 echo % qpush should fail, local changes
576 hg qpush
578 hg qpush
577
579
578 echo % apply force, should not discard changes with empty patch
580 echo % apply force, should not discard changes with empty patch
579 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
581 hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
580 hg diff --config diff.nodates=True
582 hg diff --config diff.nodates=True
581 hg qdiff --config diff.nodates=True
583 hg qdiff --config diff.nodates=True
582 hg log -l1 -p
584 hg log -l1 -p
583 hg qref -d '0 0'
585 hg qref -d '0 0'
584 hg qpop
586 hg qpop
585 echo universe >> hello.txt
587 echo universe >> hello.txt
586 echo universe >> bye.txt
588 echo universe >> bye.txt
587
589
588 echo % qpush should fail, local changes
590 echo % qpush should fail, local changes
589 hg qpush
591 hg qpush
590
592
591 echo % apply force, should discard changes in hello, but not bye
593 echo % apply force, should discard changes in hello, but not bye
592 hg qpush -f
594 hg qpush -f
593 hg st
595 hg st
594 hg diff --config diff.nodates=True
596 hg diff --config diff.nodates=True
595 hg qdiff --config diff.nodates=True
597 hg qdiff --config diff.nodates=True
596
598
597 echo % test popping revisions not in working dir ancestry
599 echo % test popping revisions not in working dir ancestry
598 hg qseries -v
600 hg qseries -v
599 hg up qparent
601 hg up qparent
600 hg qpop
602 hg qpop
601
603
602 cd ..
604 cd ..
603 hg init deletion-order
605 hg init deletion-order
604 cd deletion-order
606 cd deletion-order
605
607
606 touch a
608 touch a
607 hg ci -Aqm0
609 hg ci -Aqm0
608
610
609 hg qnew rename-dir
611 hg qnew rename-dir
610 hg rm a
612 hg rm a
611 hg qrefresh
613 hg qrefresh
612
614
613 mkdir a b
615 mkdir a b
614 touch a/a b/b
616 touch a/a b/b
615 hg add -q a b
617 hg add -q a b
616 hg qrefresh
618 hg qrefresh
617
619
618 echo % test popping must remove files added in subdirectories first
620 echo % test popping must remove files added in subdirectories first
619 hg qpop
621 hg qpop
620 cd ..
622 cd ..
@@ -1,53 +1,55
1 #!/bin/sh
1 #!/bin/sh
2
2
3 source $TESTDIR/helpers.sh
4
3 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
6 echo "mq=" >> $HGRCPATH
5
7
6 teststrip() {
8 teststrip() {
7 hg up -C $1
9 hg up -C $1
8 echo % before update $1, strip $2
10 echo % before update $1, strip $2
9 hg parents
11 hg parents
10 hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/'
12 hg strip $2 | hidebackup
11 echo % after update $1, strip $2
13 echo % after update $1, strip $2
12 hg parents
14 hg parents
13 hg unbundle -q .hg/strip-backup/*
15 hg unbundle -q .hg/strip-backup/*
14 rm .hg/strip-backup/*
16 rm .hg/strip-backup/*
15 }
17 }
16
18
17 hg init test
19 hg init test
18 cd test
20 cd test
19
21
20 echo foo > bar
22 echo foo > bar
21 hg ci -Ama
23 hg ci -Ama
22
24
23 echo more >> bar
25 echo more >> bar
24 hg ci -Amb
26 hg ci -Amb
25
27
26 echo blah >> bar
28 echo blah >> bar
27 hg ci -Amc
29 hg ci -Amc
28
30
29 hg up 1
31 hg up 1
30 echo blah >> bar
32 echo blah >> bar
31 hg ci -Amd
33 hg ci -Amd
32
34
33 echo final >> bar
35 echo final >> bar
34 hg ci -Ame
36 hg ci -Ame
35
37
36 hg log
38 hg log
37
39
38 teststrip 4 4
40 teststrip 4 4
39 teststrip 4 3
41 teststrip 4 3
40 teststrip 1 4
42 teststrip 1 4
41 teststrip 4 2
43 teststrip 4 2
42 teststrip 4 1
44 teststrip 4 1
43 teststrip null 4
45 teststrip null 4
44
46
45 hg log
47 hg log
46
48
47 hg up -C 2
49 hg up -C 2
48 hg merge 4
50 hg merge 4
49 echo % before strip of merge parent
51 echo % before strip of merge parent
50 hg parents
52 hg parents
51 hg strip 4 2>&1 | sed 's/\(saving bundle to \).*/\1/'
53 hg strip 4 2>&1 | hidebackup
52 echo % after strip of merge parent
54 echo % after strip of merge parent
53 hg parents
55 hg parents
@@ -1,172 +1,172
1 adding bar
1 adding bar
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 created new head
3 created new head
4 changeset: 4:443431ffac4f
4 changeset: 4:443431ffac4f
5 tag: tip
5 tag: tip
6 user: test
6 user: test
7 date: Thu Jan 01 00:00:00 1970 +0000
7 date: Thu Jan 01 00:00:00 1970 +0000
8 summary: e
8 summary: e
9
9
10 changeset: 3:65bd5f99a4a3
10 changeset: 3:65bd5f99a4a3
11 parent: 1:ef3a871183d7
11 parent: 1:ef3a871183d7
12 user: test
12 user: test
13 date: Thu Jan 01 00:00:00 1970 +0000
13 date: Thu Jan 01 00:00:00 1970 +0000
14 summary: d
14 summary: d
15
15
16 changeset: 2:264128213d29
16 changeset: 2:264128213d29
17 user: test
17 user: test
18 date: Thu Jan 01 00:00:00 1970 +0000
18 date: Thu Jan 01 00:00:00 1970 +0000
19 summary: c
19 summary: c
20
20
21 changeset: 1:ef3a871183d7
21 changeset: 1:ef3a871183d7
22 user: test
22 user: test
23 date: Thu Jan 01 00:00:00 1970 +0000
23 date: Thu Jan 01 00:00:00 1970 +0000
24 summary: b
24 summary: b
25
25
26 changeset: 0:9ab35a2d17cb
26 changeset: 0:9ab35a2d17cb
27 user: test
27 user: test
28 date: Thu Jan 01 00:00:00 1970 +0000
28 date: Thu Jan 01 00:00:00 1970 +0000
29 summary: a
29 summary: a
30
30
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 % before update 4, strip 4
32 % before update 4, strip 4
33 changeset: 4:443431ffac4f
33 changeset: 4:443431ffac4f
34 tag: tip
34 tag: tip
35 user: test
35 user: test
36 date: Thu Jan 01 00:00:00 1970 +0000
36 date: Thu Jan 01 00:00:00 1970 +0000
37 summary: e
37 summary: e
38
38
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 saving bundle to
40 saved backup bundle to
41 % after update 4, strip 4
41 % after update 4, strip 4
42 changeset: 3:65bd5f99a4a3
42 changeset: 3:65bd5f99a4a3
43 tag: tip
43 tag: tip
44 parent: 1:ef3a871183d7
44 parent: 1:ef3a871183d7
45 user: test
45 user: test
46 date: Thu Jan 01 00:00:00 1970 +0000
46 date: Thu Jan 01 00:00:00 1970 +0000
47 summary: d
47 summary: d
48
48
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 % before update 4, strip 3
50 % before update 4, strip 3
51 changeset: 4:443431ffac4f
51 changeset: 4:443431ffac4f
52 tag: tip
52 tag: tip
53 user: test
53 user: test
54 date: Thu Jan 01 00:00:00 1970 +0000
54 date: Thu Jan 01 00:00:00 1970 +0000
55 summary: e
55 summary: e
56
56
57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 saving bundle to
58 saved backup bundle to
59 % after update 4, strip 3
59 % after update 4, strip 3
60 changeset: 1:ef3a871183d7
60 changeset: 1:ef3a871183d7
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: b
63 summary: b
64
64
65 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 % before update 1, strip 4
66 % before update 1, strip 4
67 changeset: 1:ef3a871183d7
67 changeset: 1:ef3a871183d7
68 user: test
68 user: test
69 date: Thu Jan 01 00:00:00 1970 +0000
69 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: b
70 summary: b
71
71
72 saving bundle to
72 saved backup bundle to
73 % after update 1, strip 4
73 % after update 1, strip 4
74 changeset: 1:ef3a871183d7
74 changeset: 1:ef3a871183d7
75 user: test
75 user: test
76 date: Thu Jan 01 00:00:00 1970 +0000
76 date: Thu Jan 01 00:00:00 1970 +0000
77 summary: b
77 summary: b
78
78
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 % before update 4, strip 2
80 % before update 4, strip 2
81 changeset: 4:443431ffac4f
81 changeset: 4:443431ffac4f
82 tag: tip
82 tag: tip
83 user: test
83 user: test
84 date: Thu Jan 01 00:00:00 1970 +0000
84 date: Thu Jan 01 00:00:00 1970 +0000
85 summary: e
85 summary: e
86
86
87 saving bundle to
87 saved backup bundle to
88 adding branch
88 adding branch
89 adding changesets
89 adding changesets
90 adding manifests
90 adding manifests
91 adding file changes
91 adding file changes
92 added 2 changesets with 2 changes to 1 files
92 added 2 changesets with 2 changes to 1 files
93 % after update 4, strip 2
93 % after update 4, strip 2
94 changeset: 3:443431ffac4f
94 changeset: 3:443431ffac4f
95 tag: tip
95 tag: tip
96 user: test
96 user: test
97 date: Thu Jan 01 00:00:00 1970 +0000
97 date: Thu Jan 01 00:00:00 1970 +0000
98 summary: e
98 summary: e
99
99
100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 % before update 4, strip 1
101 % before update 4, strip 1
102 changeset: 4:264128213d29
102 changeset: 4:264128213d29
103 tag: tip
103 tag: tip
104 parent: 1:ef3a871183d7
104 parent: 1:ef3a871183d7
105 user: test
105 user: test
106 date: Thu Jan 01 00:00:00 1970 +0000
106 date: Thu Jan 01 00:00:00 1970 +0000
107 summary: c
107 summary: c
108
108
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 saving bundle to
110 saved backup bundle to
111 % after update 4, strip 1
111 % after update 4, strip 1
112 changeset: 0:9ab35a2d17cb
112 changeset: 0:9ab35a2d17cb
113 tag: tip
113 tag: tip
114 user: test
114 user: test
115 date: Thu Jan 01 00:00:00 1970 +0000
115 date: Thu Jan 01 00:00:00 1970 +0000
116 summary: a
116 summary: a
117
117
118 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
118 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 % before update null, strip 4
119 % before update null, strip 4
120 saving bundle to
120 saved backup bundle to
121 % after update null, strip 4
121 % after update null, strip 4
122 changeset: 4:264128213d29
122 changeset: 4:264128213d29
123 tag: tip
123 tag: tip
124 parent: 1:ef3a871183d7
124 parent: 1:ef3a871183d7
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:00 1970 +0000
126 date: Thu Jan 01 00:00:00 1970 +0000
127 summary: c
127 summary: c
128
128
129 changeset: 3:443431ffac4f
129 changeset: 3:443431ffac4f
130 user: test
130 user: test
131 date: Thu Jan 01 00:00:00 1970 +0000
131 date: Thu Jan 01 00:00:00 1970 +0000
132 summary: e
132 summary: e
133
133
134 changeset: 2:65bd5f99a4a3
134 changeset: 2:65bd5f99a4a3
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: d
137 summary: d
138
138
139 changeset: 1:ef3a871183d7
139 changeset: 1:ef3a871183d7
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:00 1970 +0000
141 date: Thu Jan 01 00:00:00 1970 +0000
142 summary: b
142 summary: b
143
143
144 changeset: 0:9ab35a2d17cb
144 changeset: 0:9ab35a2d17cb
145 user: test
145 user: test
146 date: Thu Jan 01 00:00:00 1970 +0000
146 date: Thu Jan 01 00:00:00 1970 +0000
147 summary: a
147 summary: a
148
148
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 (branch merge, don't forget to commit)
151 (branch merge, don't forget to commit)
152 % before strip of merge parent
152 % before strip of merge parent
153 changeset: 2:65bd5f99a4a3
153 changeset: 2:65bd5f99a4a3
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: d
156 summary: d
157
157
158 changeset: 4:264128213d29
158 changeset: 4:264128213d29
159 tag: tip
159 tag: tip
160 parent: 1:ef3a871183d7
160 parent: 1:ef3a871183d7
161 user: test
161 user: test
162 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
163 summary: c
163 summary: c
164
164
165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 saving bundle to
166 saved backup bundle to
167 % after strip of merge parent
167 % after strip of merge parent
168 changeset: 1:ef3a871183d7
168 changeset: 1:ef3a871183d7
169 user: test
169 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
170 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: b
171 summary: b
172
172
@@ -1,650 +1,650
1 % help
1 % help
2 mq extension - manage a stack of patches
2 mq extension - manage a stack of patches
3
3
4 This extension lets you work with a stack of patches in a Mercurial
4 This extension lets you work with a stack of patches in a Mercurial
5 repository. It manages two stacks of patches - all known patches, and applied
5 repository. It manages two stacks of patches - all known patches, and applied
6 patches (subset of known patches).
6 patches (subset of known patches).
7
7
8 Known patches are represented as patch files in the .hg/patches directory.
8 Known patches are represented as patch files in the .hg/patches directory.
9 Applied patches are both patch files and changesets.
9 Applied patches are both patch files and changesets.
10
10
11 Common tasks (use "hg help command" for more details):
11 Common tasks (use "hg help command" for more details):
12
12
13 create new patch qnew
13 create new patch qnew
14 import existing patch qimport
14 import existing patch qimport
15
15
16 print patch series qseries
16 print patch series qseries
17 print applied patches qapplied
17 print applied patches qapplied
18
18
19 add known patch to applied stack qpush
19 add known patch to applied stack qpush
20 remove patch from applied stack qpop
20 remove patch from applied stack qpop
21 refresh contents of top applied patch qrefresh
21 refresh contents of top applied patch qrefresh
22
22
23 By default, mq will automatically use git patches when required to avoid
23 By default, mq will automatically use git patches when required to avoid
24 losing file mode changes, copy records, binary files or empty files creations
24 losing file mode changes, copy records, binary files or empty files creations
25 or deletions. This behaviour can be configured with:
25 or deletions. This behaviour can be configured with:
26
26
27 [mq]
27 [mq]
28 git = auto/keep/yes/no
28 git = auto/keep/yes/no
29
29
30 If set to 'keep', mq will obey the [diff] section configuration while
30 If set to 'keep', mq will obey the [diff] section configuration while
31 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
31 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
32 will override the [diff] section and always generate git or regular patches,
32 will override the [diff] section and always generate git or regular patches,
33 possibly losing data in the second case.
33 possibly losing data in the second case.
34
34
35 list of commands:
35 list of commands:
36
36
37 qapplied print the patches already applied
37 qapplied print the patches already applied
38 qclone clone main and patch repository at same time
38 qclone clone main and patch repository at same time
39 qdelete remove patches from queue
39 qdelete remove patches from queue
40 qdiff diff of the current patch and subsequent modifications
40 qdiff diff of the current patch and subsequent modifications
41 qfinish move applied patches into repository history
41 qfinish move applied patches into repository history
42 qfold fold the named patches into the current patch
42 qfold fold the named patches into the current patch
43 qgoto push or pop patches until named patch is at top of stack
43 qgoto push or pop patches until named patch is at top of stack
44 qguard set or print guards for a patch
44 qguard set or print guards for a patch
45 qheader print the header of the topmost or specified patch
45 qheader print the header of the topmost or specified patch
46 qimport import a patch
46 qimport import a patch
47 qnew create a new patch
47 qnew create a new patch
48 qnext print the name of the next patch
48 qnext print the name of the next patch
49 qpop pop the current patch off the stack
49 qpop pop the current patch off the stack
50 qprev print the name of the previous patch
50 qprev print the name of the previous patch
51 qpush push the next patch onto the stack
51 qpush push the next patch onto the stack
52 qrefresh update the current patch
52 qrefresh update the current patch
53 qrename rename a patch
53 qrename rename a patch
54 qselect set or print guarded patches to push
54 qselect set or print guarded patches to push
55 qseries print the entire series file
55 qseries print the entire series file
56 qtop print the name of the current patch
56 qtop print the name of the current patch
57 qunapplied print the patches not yet applied
57 qunapplied print the patches not yet applied
58 strip strip a changeset and all its descendants from the repository
58 strip strip a changeset and all its descendants from the repository
59
59
60 use "hg -v help mq" to show aliases and global options
60 use "hg -v help mq" to show aliases and global options
61 adding a
61 adding a
62 updating to branch default
62 updating to branch default
63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 adding b/z
64 adding b/z
65 % qinit
65 % qinit
66 % -R qinit
66 % -R qinit
67 % qinit -c
67 % qinit -c
68 A .hgignore
68 A .hgignore
69 A series
69 A series
70 % qinit; qinit -c
70 % qinit; qinit -c
71 .hgignore:
71 .hgignore:
72 ^\.hg
72 ^\.hg
73 ^\.mq
73 ^\.mq
74 syntax: glob
74 syntax: glob
75 status
75 status
76 guards
76 guards
77 series:
77 series:
78 abort: repository already exists!
78 abort: repository already exists!
79 % qinit; <stuff>; qinit -c
79 % qinit; <stuff>; qinit -c
80 adding .hg/patches/A
80 adding .hg/patches/A
81 adding .hg/patches/B
81 adding .hg/patches/B
82 A .hgignore
82 A .hgignore
83 A A
83 A A
84 A B
84 A B
85 A series
85 A series
86 .hgignore:
86 .hgignore:
87 status
87 status
88 bleh
88 bleh
89 series:
89 series:
90 A
90 A
91 B
91 B
92 % init --mq without repo
92 % init --mq without repo
93 abort: There is no Mercurial repository here (.hg not found)
93 abort: There is no Mercurial repository here (.hg not found)
94 % init --mq with repo path
94 % init --mq with repo path
95 ok
95 ok
96 % init --mq with nonexistent directory
96 % init --mq with nonexistent directory
97 abort: repository nonexistentdir not found!
97 abort: repository nonexistentdir not found!
98 % init --mq with bundle (non "local")
98 % init --mq with bundle (non "local")
99 abort: only a local queue repository may be initialized
99 abort: only a local queue repository may be initialized
100 % qrefresh
100 % qrefresh
101 foo bar
101 foo bar
102
102
103 diff -r xa
103 diff -r xa
104 --- a/a
104 --- a/a
105 +++ b/a
105 +++ b/a
106 @@ -1,1 +1,2 @@
106 @@ -1,1 +1,2 @@
107 a
107 a
108 +a
108 +a
109 % empty qrefresh
109 % empty qrefresh
110 revision:
110 revision:
111 patch:
111 patch:
112 foo bar
112 foo bar
113
113
114 working dir diff:
114 working dir diff:
115 --- a/a
115 --- a/a
116 +++ b/a
116 +++ b/a
117 @@ -1,1 +1,2 @@
117 @@ -1,1 +1,2 @@
118 a
118 a
119 +a
119 +a
120 % qpop
120 % qpop
121 popping test.patch
121 popping test.patch
122 patch queue now empty
122 patch queue now empty
123 % qpush with dump of tag cache
123 % qpush with dump of tag cache
124 .hg/tags.cache (pre qpush):
124 .hg/tags.cache (pre qpush):
125 1
125 1
126
126
127 applying test.patch
127 applying test.patch
128 now at: test.patch
128 now at: test.patch
129 .hg/tags.cache (post qpush):
129 .hg/tags.cache (post qpush):
130 2
130 2
131
131
132 % pop/push outside repo
132 % pop/push outside repo
133 popping test.patch
133 popping test.patch
134 patch queue now empty
134 patch queue now empty
135 applying test.patch
135 applying test.patch
136 now at: test.patch
136 now at: test.patch
137 % qrefresh in subdir
137 % qrefresh in subdir
138 % pop/push -a in subdir
138 % pop/push -a in subdir
139 popping test2.patch
139 popping test2.patch
140 popping test.patch
140 popping test.patch
141 patch queue now empty
141 patch queue now empty
142 applying test.patch
142 applying test.patch
143 applying test2.patch
143 applying test2.patch
144 now at: test2.patch
144 now at: test2.patch
145 % qseries
145 % qseries
146 test.patch
146 test.patch
147 test2.patch
147 test2.patch
148 0 A test.patch: f...
148 0 A test.patch: f...
149 1 A test2.patch:
149 1 A test2.patch:
150 popping test2.patch
150 popping test2.patch
151 now at: test.patch
151 now at: test.patch
152 0 A test.patch: foo bar
152 0 A test.patch: foo bar
153 1 U test2.patch:
153 1 U test2.patch:
154 mq: 1 applied, 1 unapplied
154 mq: 1 applied, 1 unapplied
155 applying test2.patch
155 applying test2.patch
156 now at: test2.patch
156 now at: test2.patch
157 mq: 2 applied
157 mq: 2 applied
158 % qapplied
158 % qapplied
159 test.patch
159 test.patch
160 test2.patch
160 test2.patch
161 % qtop
161 % qtop
162 test2.patch
162 test2.patch
163 % prev
163 % prev
164 test.patch
164 test.patch
165 % next
165 % next
166 all patches applied
166 all patches applied
167 popping test2.patch
167 popping test2.patch
168 now at: test.patch
168 now at: test.patch
169 % commit should fail
169 % commit should fail
170 abort: cannot commit over an applied mq patch
170 abort: cannot commit over an applied mq patch
171 % push should fail
171 % push should fail
172 pushing to ../../k
172 pushing to ../../k
173 abort: source has mq patches applied
173 abort: source has mq patches applied
174 % import should fail
174 % import should fail
175 abort: cannot import over an applied patch
175 abort: cannot import over an applied patch
176 % import --no-commit should succeed
176 % import --no-commit should succeed
177 applying ../../import.diff
177 applying ../../import.diff
178 M a
178 M a
179 % qunapplied
179 % qunapplied
180 test2.patch
180 test2.patch
181 % qpush/qpop with index
181 % qpush/qpop with index
182 applying test2.patch
182 applying test2.patch
183 now at: test2.patch
183 now at: test2.patch
184 popping test2.patch
184 popping test2.patch
185 popping test1b.patch
185 popping test1b.patch
186 now at: test.patch
186 now at: test.patch
187 applying test1b.patch
187 applying test1b.patch
188 now at: test1b.patch
188 now at: test1b.patch
189 applying test2.patch
189 applying test2.patch
190 now at: test2.patch
190 now at: test2.patch
191 popping test2.patch
191 popping test2.patch
192 now at: test1b.patch
192 now at: test1b.patch
193 popping test1b.patch
193 popping test1b.patch
194 now at: test.patch
194 now at: test.patch
195 applying test1b.patch
195 applying test1b.patch
196 applying test2.patch
196 applying test2.patch
197 now at: test2.patch
197 now at: test2.patch
198 % qpush --move
198 % qpush --move
199 popping test2.patch
199 popping test2.patch
200 popping test1b.patch
200 popping test1b.patch
201 popping test.patch
201 popping test.patch
202 patch queue now empty
202 patch queue now empty
203 applying test2.patch
203 applying test2.patch
204 now at: test2.patch
204 now at: test2.patch
205 applying test1b.patch
205 applying test1b.patch
206 now at: test1b.patch
206 now at: test1b.patch
207 applying test.patch
207 applying test.patch
208 now at: test.patch
208 now at: test.patch
209 0 A test2.patch
209 0 A test2.patch
210 1 A test1b.patch
210 1 A test1b.patch
211 2 A test.patch
211 2 A test.patch
212 popping test.patch
212 popping test.patch
213 popping test1b.patch
213 popping test1b.patch
214 popping test2.patch
214 popping test2.patch
215 patch queue now empty
215 patch queue now empty
216 applying test.patch
216 applying test.patch
217 now at: test.patch
217 now at: test.patch
218 applying test1b.patch
218 applying test1b.patch
219 now at: test1b.patch
219 now at: test1b.patch
220 abort: patch bogus not in series
220 abort: patch bogus not in series
221 abort: cannot push to a previous patch: test.patch
221 abort: cannot push to a previous patch: test.patch
222 applying test2.patch
222 applying test2.patch
223 now at: test2.patch
223 now at: test2.patch
224 % pop, qapplied, qunapplied
224 % pop, qapplied, qunapplied
225 0 A test.patch
225 0 A test.patch
226 1 A test1b.patch
226 1 A test1b.patch
227 2 A test2.patch
227 2 A test2.patch
228 % qapplied -1 test.patch
228 % qapplied -1 test.patch
229 only one patch applied
229 only one patch applied
230 % qapplied -1 test1b.patch
230 % qapplied -1 test1b.patch
231 test.patch
231 test.patch
232 % qapplied -1 test2.patch
232 % qapplied -1 test2.patch
233 test1b.patch
233 test1b.patch
234 % qapplied -1
234 % qapplied -1
235 test1b.patch
235 test1b.patch
236 % qapplied
236 % qapplied
237 test.patch
237 test.patch
238 test1b.patch
238 test1b.patch
239 test2.patch
239 test2.patch
240 % qapplied test1b.patch
240 % qapplied test1b.patch
241 test.patch
241 test.patch
242 test1b.patch
242 test1b.patch
243 % qunapplied -1
243 % qunapplied -1
244 all patches applied
244 all patches applied
245 % qunapplied
245 % qunapplied
246 % popping
246 % popping
247 popping test2.patch
247 popping test2.patch
248 now at: test1b.patch
248 now at: test1b.patch
249 % qunapplied -1
249 % qunapplied -1
250 test2.patch
250 test2.patch
251 % qunapplied
251 % qunapplied
252 test2.patch
252 test2.patch
253 % qunapplied test2.patch
253 % qunapplied test2.patch
254 % qunapplied -1 test2.patch
254 % qunapplied -1 test2.patch
255 all patches applied
255 all patches applied
256 % popping -a
256 % popping -a
257 popping test1b.patch
257 popping test1b.patch
258 popping test.patch
258 popping test.patch
259 patch queue now empty
259 patch queue now empty
260 % qapplied
260 % qapplied
261 % qapplied -1
261 % qapplied -1
262 no patches applied
262 no patches applied
263 applying test.patch
263 applying test.patch
264 now at: test.patch
264 now at: test.patch
265 % push should succeed
265 % push should succeed
266 popping test.patch
266 popping test.patch
267 patch queue now empty
267 patch queue now empty
268 pushing to ../../k
268 pushing to ../../k
269 searching for changes
269 searching for changes
270 adding changesets
270 adding changesets
271 adding manifests
271 adding manifests
272 adding file changes
272 adding file changes
273 added 1 changesets with 1 changes to 1 files
273 added 1 changesets with 1 changes to 1 files
274 % qpush/qpop error codes
274 % qpush/qpop error codes
275 applying test.patch
275 applying test.patch
276 applying test1b.patch
276 applying test1b.patch
277 applying test2.patch
277 applying test2.patch
278 now at: test2.patch
278 now at: test2.patch
279 % pops all patches and succeeds
279 % pops all patches and succeeds
280 popping test2.patch
280 popping test2.patch
281 popping test1b.patch
281 popping test1b.patch
282 popping test.patch
282 popping test.patch
283 patch queue now empty
283 patch queue now empty
284 qpop -a succeeds
284 qpop -a succeeds
285 % does nothing and succeeds
285 % does nothing and succeeds
286 no patches applied
286 no patches applied
287 qpop -a succeeds
287 qpop -a succeeds
288 % fails - nothing else to pop
288 % fails - nothing else to pop
289 no patches applied
289 no patches applied
290 qpop fails
290 qpop fails
291 % pushes a patch and succeeds
291 % pushes a patch and succeeds
292 applying test.patch
292 applying test.patch
293 now at: test.patch
293 now at: test.patch
294 qpush succeeds
294 qpush succeeds
295 % pops a patch and succeeds
295 % pops a patch and succeeds
296 popping test.patch
296 popping test.patch
297 patch queue now empty
297 patch queue now empty
298 qpop succeeds
298 qpop succeeds
299 % pushes up to test1b.patch and succeeds
299 % pushes up to test1b.patch and succeeds
300 applying test.patch
300 applying test.patch
301 applying test1b.patch
301 applying test1b.patch
302 now at: test1b.patch
302 now at: test1b.patch
303 qpush test1b.patch succeeds
303 qpush test1b.patch succeeds
304 % does nothing and succeeds
304 % does nothing and succeeds
305 qpush: test1b.patch is already at the top
305 qpush: test1b.patch is already at the top
306 qpush test1b.patch succeeds
306 qpush test1b.patch succeeds
307 % does nothing and succeeds
307 % does nothing and succeeds
308 qpop: test1b.patch is already at the top
308 qpop: test1b.patch is already at the top
309 qpop test1b.patch succeeds
309 qpop test1b.patch succeeds
310 % fails - can't push to this patch
310 % fails - can't push to this patch
311 abort: cannot push to a previous patch: test.patch
311 abort: cannot push to a previous patch: test.patch
312 qpush test.patch fails
312 qpush test.patch fails
313 % fails - can't pop to this patch
313 % fails - can't pop to this patch
314 abort: patch test2.patch is not applied
314 abort: patch test2.patch is not applied
315 qpop test2.patch fails
315 qpop test2.patch fails
316 % pops up to test.patch and succeeds
316 % pops up to test.patch and succeeds
317 popping test1b.patch
317 popping test1b.patch
318 now at: test.patch
318 now at: test.patch
319 qpop test.patch succeeds
319 qpop test.patch succeeds
320 % pushes all patches and succeeds
320 % pushes all patches and succeeds
321 applying test1b.patch
321 applying test1b.patch
322 applying test2.patch
322 applying test2.patch
323 now at: test2.patch
323 now at: test2.patch
324 qpush -a succeeds
324 qpush -a succeeds
325 % does nothing and succeeds
325 % does nothing and succeeds
326 all patches are currently applied
326 all patches are currently applied
327 qpush -a succeeds
327 qpush -a succeeds
328 % fails - nothing else to push
328 % fails - nothing else to push
329 patch series already fully applied
329 patch series already fully applied
330 qpush fails
330 qpush fails
331 % does nothing and succeeds
331 % does nothing and succeeds
332 qpush: test2.patch is already at the top
332 qpush: test2.patch is already at the top
333 qpush test2.patch succeeds
333 qpush test2.patch succeeds
334 % strip
334 % strip
335 adding x
335 adding x
336 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
336 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
337 saving bundle to
337 saved backup bundle to
338 adding changesets
338 adding changesets
339 adding manifests
339 adding manifests
340 adding file changes
340 adding file changes
341 added 1 changesets with 1 changes to 1 files
341 added 1 changesets with 1 changes to 1 files
342 (run 'hg update' to get a working copy)
342 (run 'hg update' to get a working copy)
343 % strip with local changes, should complain
343 % strip with local changes, should complain
344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 abort: local changes found
345 abort: local changes found
346 % --force strip with local changes
346 % --force strip with local changes
347 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
347 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
348 saving bundle to
348 saved backup bundle to
349 % cd b; hg qrefresh
349 % cd b; hg qrefresh
350 adding a
350 adding a
351 foo
351 foo
352
352
353 diff -r cb9a9f314b8b a
353 diff -r cb9a9f314b8b a
354 --- a/a
354 --- a/a
355 +++ b/a
355 +++ b/a
356 @@ -1,1 +1,2 @@
356 @@ -1,1 +1,2 @@
357 a
357 a
358 +a
358 +a
359 diff -r cb9a9f314b8b b/f
359 diff -r cb9a9f314b8b b/f
360 --- /dev/null
360 --- /dev/null
361 +++ b/b/f
361 +++ b/b/f
362 @@ -0,0 +1,1 @@
362 @@ -0,0 +1,1 @@
363 +f
363 +f
364 % hg qrefresh .
364 % hg qrefresh .
365 foo
365 foo
366
366
367 diff -r cb9a9f314b8b b/f
367 diff -r cb9a9f314b8b b/f
368 --- /dev/null
368 --- /dev/null
369 +++ b/b/f
369 +++ b/b/f
370 @@ -0,0 +1,1 @@
370 @@ -0,0 +1,1 @@
371 +f
371 +f
372 M a
372 M a
373 % qpush failure
373 % qpush failure
374 popping bar
374 popping bar
375 popping foo
375 popping foo
376 patch queue now empty
376 patch queue now empty
377 applying foo
377 applying foo
378 applying bar
378 applying bar
379 file foo already exists
379 file foo already exists
380 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
380 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
381 patch failed, unable to continue (try -v)
381 patch failed, unable to continue (try -v)
382 patch failed, rejects left in working dir
382 patch failed, rejects left in working dir
383 errors during apply, please fix and refresh bar
383 errors during apply, please fix and refresh bar
384 ? foo
384 ? foo
385 ? foo.rej
385 ? foo.rej
386 % mq tags
386 % mq tags
387 0 qparent
387 0 qparent
388 1 foo qbase
388 1 foo qbase
389 2 bar qtip tip
389 2 bar qtip tip
390 % bad node in status
390 % bad node in status
391 popping bar
391 popping bar
392 now at: foo
392 now at: foo
393 changeset: 0:cb9a9f314b8b
393 changeset: 0:cb9a9f314b8b
394 mq status file refers to unknown node
394 mq status file refers to unknown node
395 tag: tip
395 tag: tip
396 user: test
396 user: test
397 date: Thu Jan 01 00:00:00 1970 +0000
397 date: Thu Jan 01 00:00:00 1970 +0000
398 summary: a
398 summary: a
399
399
400 mq status file refers to unknown node
400 mq status file refers to unknown node
401 default 0:cb9a9f314b8b
401 default 0:cb9a9f314b8b
402 abort: trying to pop unknown node
402 abort: trying to pop unknown node
403 new file
403 new file
404
404
405 diff --git a/new b/new
405 diff --git a/new b/new
406 new file mode 100755
406 new file mode 100755
407 --- /dev/null
407 --- /dev/null
408 +++ b/new
408 +++ b/new
409 @@ -0,0 +1,1 @@
409 @@ -0,0 +1,1 @@
410 +foo
410 +foo
411 copy file
411 copy file
412
412
413 diff --git a/new b/copy
413 diff --git a/new b/copy
414 copy from new
414 copy from new
415 copy to copy
415 copy to copy
416 popping copy
416 popping copy
417 now at: new
417 now at: new
418 applying copy
418 applying copy
419 now at: copy
419 now at: copy
420 diff --git a/new b/copy
420 diff --git a/new b/copy
421 copy from new
421 copy from new
422 copy to copy
422 copy to copy
423 diff --git a/new b/copy
423 diff --git a/new b/copy
424 copy from new
424 copy from new
425 copy to copy
425 copy to copy
426 % test file addition in slow path
426 % test file addition in slow path
427 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
427 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
428 created new head
428 created new head
429 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
429 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 adding branch
430 adding branch
431 adding changesets
431 adding changesets
432 adding manifests
432 adding manifests
433 adding file changes
433 adding file changes
434 added 1 changesets with 1 changes to 1 files
434 added 1 changesets with 1 changes to 1 files
435 diff --git a/bar b/bar
435 diff --git a/bar b/bar
436 new file mode 100644
436 new file mode 100644
437 --- /dev/null
437 --- /dev/null
438 +++ b/bar
438 +++ b/bar
439 @@ -0,0 +1,1 @@
439 @@ -0,0 +1,1 @@
440 +bar
440 +bar
441 diff --git a/foo b/baz
441 diff --git a/foo b/baz
442 rename from foo
442 rename from foo
443 rename to baz
443 rename to baz
444 2 baz (foo)
444 2 baz (foo)
445 diff --git a/bar b/bar
445 diff --git a/bar b/bar
446 new file mode 100644
446 new file mode 100644
447 --- /dev/null
447 --- /dev/null
448 +++ b/bar
448 +++ b/bar
449 @@ -0,0 +1,1 @@
449 @@ -0,0 +1,1 @@
450 +bar
450 +bar
451 diff --git a/foo b/baz
451 diff --git a/foo b/baz
452 rename from foo
452 rename from foo
453 rename to baz
453 rename to baz
454 2 baz (foo)
454 2 baz (foo)
455 diff --git a/bar b/bar
455 diff --git a/bar b/bar
456 diff --git a/foo b/baz
456 diff --git a/foo b/baz
457 % test file move chains in the slow path
457 % test file move chains in the slow path
458 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
458 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
459 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
459 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
460 adding branch
460 adding branch
461 adding changesets
461 adding changesets
462 adding manifests
462 adding manifests
463 adding file changes
463 adding file changes
464 added 1 changesets with 1 changes to 1 files
464 added 1 changesets with 1 changes to 1 files
465 diff --git a/foo b/bleh
465 diff --git a/foo b/bleh
466 rename from foo
466 rename from foo
467 rename to bleh
467 rename to bleh
468 diff --git a/quux b/quux
468 diff --git a/quux b/quux
469 new file mode 100644
469 new file mode 100644
470 --- /dev/null
470 --- /dev/null
471 +++ b/quux
471 +++ b/quux
472 @@ -0,0 +1,1 @@
472 @@ -0,0 +1,1 @@
473 +bar
473 +bar
474 3 bleh (foo)
474 3 bleh (foo)
475 diff --git a/foo b/barney
475 diff --git a/foo b/barney
476 rename from foo
476 rename from foo
477 rename to barney
477 rename to barney
478 diff --git a/fred b/fred
478 diff --git a/fred b/fred
479 new file mode 100644
479 new file mode 100644
480 --- /dev/null
480 --- /dev/null
481 +++ b/fred
481 +++ b/fred
482 @@ -0,0 +1,1 @@
482 @@ -0,0 +1,1 @@
483 +bar
483 +bar
484 3 barney (foo)
484 3 barney (foo)
485 % refresh omitting an added file
485 % refresh omitting an added file
486 C newfile
486 C newfile
487 A newfile
487 A newfile
488 popping baz
488 popping baz
489 now at: bar
489 now at: bar
490 % create a git patch
490 % create a git patch
491 diff --git a/alexander b/alexander
491 diff --git a/alexander b/alexander
492 % create a git binary patch
492 % create a git binary patch
493 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
493 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
494 diff --git a/bucephalus b/bucephalus
494 diff --git a/bucephalus b/bucephalus
495 % check binary patches can be popped and pushed
495 % check binary patches can be popped and pushed
496 popping addbucephalus
496 popping addbucephalus
497 now at: addalexander
497 now at: addalexander
498 applying addbucephalus
498 applying addbucephalus
499 now at: addbucephalus
499 now at: addbucephalus
500 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
500 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
501 % strip again
501 % strip again
502 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
502 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
503 created new head
503 created new head
504 merging foo
504 merging foo
505 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
505 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
506 (branch merge, don't forget to commit)
506 (branch merge, don't forget to commit)
507 changeset: 3:99615015637b
507 changeset: 3:99615015637b
508 tag: tip
508 tag: tip
509 parent: 2:20cbbe65cff7
509 parent: 2:20cbbe65cff7
510 parent: 1:d2871fc282d4
510 parent: 1:d2871fc282d4
511 user: test
511 user: test
512 date: Thu Jan 01 00:00:00 1970 +0000
512 date: Thu Jan 01 00:00:00 1970 +0000
513 summary: merge
513 summary: merge
514
514
515 changeset: 2:20cbbe65cff7
515 changeset: 2:20cbbe65cff7
516 parent: 0:53245c60e682
516 parent: 0:53245c60e682
517 user: test
517 user: test
518 date: Thu Jan 01 00:00:00 1970 +0000
518 date: Thu Jan 01 00:00:00 1970 +0000
519 summary: change foo 2
519 summary: change foo 2
520
520
521 changeset: 1:d2871fc282d4
521 changeset: 1:d2871fc282d4
522 user: test
522 user: test
523 date: Thu Jan 01 00:00:00 1970 +0000
523 date: Thu Jan 01 00:00:00 1970 +0000
524 summary: change foo 1
524 summary: change foo 1
525
525
526 changeset: 0:53245c60e682
526 changeset: 0:53245c60e682
527 user: test
527 user: test
528 date: Thu Jan 01 00:00:00 1970 +0000
528 date: Thu Jan 01 00:00:00 1970 +0000
529 summary: add foo
529 summary: add foo
530
530
531 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 saving bundle to
532 saved backup bundle to
533 adding branch
533 adding branch
534 adding changesets
534 adding changesets
535 adding manifests
535 adding manifests
536 adding file changes
536 adding file changes
537 added 1 changesets with 1 changes to 1 files
537 added 1 changesets with 1 changes to 1 files
538 changeset: 1:20cbbe65cff7
538 changeset: 1:20cbbe65cff7
539 tag: tip
539 tag: tip
540 user: test
540 user: test
541 date: Thu Jan 01 00:00:00 1970 +0000
541 date: Thu Jan 01 00:00:00 1970 +0000
542 summary: change foo 2
542 summary: change foo 2
543
543
544 changeset: 0:53245c60e682
544 changeset: 0:53245c60e682
545 user: test
545 user: test
546 date: Thu Jan 01 00:00:00 1970 +0000
546 date: Thu Jan 01 00:00:00 1970 +0000
547 summary: add foo
547 summary: add foo
548
548
549 % qclone
549 % qclone
550 abort: versioned patch repository not found (see init --mq)
550 abort: versioned patch repository not found (see init --mq)
551 adding .hg/patches/patch1
551 adding .hg/patches/patch1
552 main repo:
552 main repo:
553 rev 1: change foo
553 rev 1: change foo
554 rev 0: add foo
554 rev 0: add foo
555 patch repo:
555 patch repo:
556 rev 0: checkpoint
556 rev 0: checkpoint
557 updating to branch default
557 updating to branch default
558 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
558 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
560 main repo:
560 main repo:
561 rev 0: add foo
561 rev 0: add foo
562 patch repo:
562 patch repo:
563 rev 0: checkpoint
563 rev 0: checkpoint
564 popping patch1
564 popping patch1
565 patch queue now empty
565 patch queue now empty
566 main repo:
566 main repo:
567 rev 0: add foo
567 rev 0: add foo
568 patch repo:
568 patch repo:
569 rev 0: checkpoint
569 rev 0: checkpoint
570 updating to branch default
570 updating to branch default
571 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
571 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
573 main repo:
573 main repo:
574 rev 0: add foo
574 rev 0: add foo
575 patch repo:
575 patch repo:
576 rev 0: checkpoint
576 rev 0: checkpoint
577 % test applying on an empty file (issue 1033)
577 % test applying on an empty file (issue 1033)
578 adding a
578 adding a
579 popping changea
579 popping changea
580 patch queue now empty
580 patch queue now empty
581 applying changea
581 applying changea
582 now at: changea
582 now at: changea
583 % test qpush with --force, issue1087
583 % test qpush with --force, issue1087
584 adding bye.txt
584 adding bye.txt
585 adding hello.txt
585 adding hello.txt
586 popping empty
586 popping empty
587 patch queue now empty
587 patch queue now empty
588 % qpush should fail, local changes
588 % qpush should fail, local changes
589 abort: local changes found, refresh first
589 abort: local changes found, refresh first
590 % apply force, should not discard changes with empty patch
590 % apply force, should not discard changes with empty patch
591 applying empty
591 applying empty
592 patch empty is empty
592 patch empty is empty
593 now at: empty
593 now at: empty
594 diff -r bf5fc3f07a0a hello.txt
594 diff -r bf5fc3f07a0a hello.txt
595 --- a/hello.txt
595 --- a/hello.txt
596 +++ b/hello.txt
596 +++ b/hello.txt
597 @@ -1,1 +1,2 @@
597 @@ -1,1 +1,2 @@
598 hello
598 hello
599 +world
599 +world
600 diff -r 9ecee4f634e3 hello.txt
600 diff -r 9ecee4f634e3 hello.txt
601 --- a/hello.txt
601 --- a/hello.txt
602 +++ b/hello.txt
602 +++ b/hello.txt
603 @@ -1,1 +1,2 @@
603 @@ -1,1 +1,2 @@
604 hello
604 hello
605 +world
605 +world
606 changeset: 1:bf5fc3f07a0a
606 changeset: 1:bf5fc3f07a0a
607 tag: empty
607 tag: empty
608 tag: qbase
608 tag: qbase
609 tag: qtip
609 tag: qtip
610 tag: tip
610 tag: tip
611 user: test
611 user: test
612 date: Thu Jan 01 00:00:00 1970 +0000
612 date: Thu Jan 01 00:00:00 1970 +0000
613 summary: imported patch empty
613 summary: imported patch empty
614
614
615
615
616 popping empty
616 popping empty
617 patch queue now empty
617 patch queue now empty
618 % qpush should fail, local changes
618 % qpush should fail, local changes
619 abort: local changes found, refresh first
619 abort: local changes found, refresh first
620 % apply force, should discard changes in hello, but not bye
620 % apply force, should discard changes in hello, but not bye
621 applying empty
621 applying empty
622 now at: empty
622 now at: empty
623 M bye.txt
623 M bye.txt
624 diff -r ba252371dbc1 bye.txt
624 diff -r ba252371dbc1 bye.txt
625 --- a/bye.txt
625 --- a/bye.txt
626 +++ b/bye.txt
626 +++ b/bye.txt
627 @@ -1,1 +1,2 @@
627 @@ -1,1 +1,2 @@
628 bye
628 bye
629 +universe
629 +universe
630 diff -r 9ecee4f634e3 bye.txt
630 diff -r 9ecee4f634e3 bye.txt
631 --- a/bye.txt
631 --- a/bye.txt
632 +++ b/bye.txt
632 +++ b/bye.txt
633 @@ -1,1 +1,2 @@
633 @@ -1,1 +1,2 @@
634 bye
634 bye
635 +universe
635 +universe
636 diff -r 9ecee4f634e3 hello.txt
636 diff -r 9ecee4f634e3 hello.txt
637 --- a/hello.txt
637 --- a/hello.txt
638 +++ b/hello.txt
638 +++ b/hello.txt
639 @@ -1,1 +1,3 @@
639 @@ -1,1 +1,3 @@
640 hello
640 hello
641 +world
641 +world
642 +universe
642 +universe
643 % test popping revisions not in working dir ancestry
643 % test popping revisions not in working dir ancestry
644 0 A empty
644 0 A empty
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 popping empty
646 popping empty
647 patch queue now empty
647 patch queue now empty
648 % test popping must remove files added in subdirectories first
648 % test popping must remove files added in subdirectories first
649 popping rename-dir
649 popping rename-dir
650 patch queue now empty
650 patch queue now empty
@@ -1,92 +1,92
1 % before update 0, strip 2
1 % before update 0, strip 2
2 changeset: 0:cb9a9f314b8b
2 changeset: 0:cb9a9f314b8b
3 user: test
3 user: test
4 date: Thu Jan 01 00:00:00 1970 +0000
4 date: Thu Jan 01 00:00:00 1970 +0000
5 summary: a
5 summary: a
6
6
7 saving bundle
7 saved backup bundle
8 transaction abort!
8 transaction abort!
9 failed to truncate data/b.i
9 failed to truncate data/b.i
10 rollback failed - please run hg recover
10 rollback failed - please run hg recover
11 strip failed, full bundle
11 strip failed, full bundle
12 abort: Permission denied .hg/store/data/b.i
12 abort: Permission denied .hg/store/data/b.i
13 % after update 0, strip 2
13 % after update 0, strip 2
14 abandoned transaction found - run hg recover
14 abandoned transaction found - run hg recover
15 checking changesets
15 checking changesets
16 checking manifests
16 checking manifests
17 crosschecking files in changesets and manifests
17 crosschecking files in changesets and manifests
18 checking files
18 checking files
19 b@?: rev 1 points to nonexistent changeset 2
19 b@?: rev 1 points to nonexistent changeset 2
20 (expected 1)
20 (expected 1)
21 b@?: 736c29771fba not in manifests
21 b@?: 736c29771fba not in manifests
22 warning: orphan revlog 'data/c.i'
22 warning: orphan revlog 'data/c.i'
23 2 files, 2 changesets, 3 total revisions
23 2 files, 2 changesets, 3 total revisions
24 2 warnings encountered!
24 2 warnings encountered!
25 2 integrity errors encountered!
25 2 integrity errors encountered!
26 % journal contents
26 % journal contents
27 00changelog.i
27 00changelog.i
28 00manifest.i
28 00manifest.i
29 data/b.i
29 data/b.i
30 data/c.i
30 data/c.i
31 rolling back interrupted transaction
31 rolling back interrupted transaction
32 checking changesets
32 checking changesets
33 checking manifests
33 checking manifests
34 crosschecking files in changesets and manifests
34 crosschecking files in changesets and manifests
35 checking files
35 checking files
36 2 files, 2 changesets, 2 total revisions
36 2 files, 2 changesets, 2 total revisions
37 % before update 0, strip 2
37 % before update 0, strip 2
38 changeset: 0:cb9a9f314b8b
38 changeset: 0:cb9a9f314b8b
39 user: test
39 user: test
40 date: Thu Jan 01 00:00:00 1970 +0000
40 date: Thu Jan 01 00:00:00 1970 +0000
41 summary: a
41 summary: a
42
42
43 abort: Permission denied .hg/store/data/b.i
43 abort: Permission denied .hg/store/data/b.i
44 % after update 0, strip 2
44 % after update 0, strip 2
45 checking changesets
45 checking changesets
46 checking manifests
46 checking manifests
47 crosschecking files in changesets and manifests
47 crosschecking files in changesets and manifests
48 checking files
48 checking files
49 3 files, 4 changesets, 4 total revisions
49 3 files, 4 changesets, 4 total revisions
50 % journal contents
50 % journal contents
51 (no journal)
51 (no journal)
52 % before update 0, strip 2
52 % before update 0, strip 2
53 changeset: 0:cb9a9f314b8b
53 changeset: 0:cb9a9f314b8b
54 user: test
54 user: test
55 date: Thu Jan 01 00:00:00 1970 +0000
55 date: Thu Jan 01 00:00:00 1970 +0000
56 summary: a
56 summary: a
57
57
58 saving bundle
58 saved backup bundle
59 transaction abort!
59 transaction abort!
60 failed to truncate 00manifest.i
60 failed to truncate 00manifest.i
61 rollback failed - please run hg recover
61 rollback failed - please run hg recover
62 strip failed, full bundle
62 strip failed, full bundle
63 abort: Permission denied .hg/store/00manifest.i
63 abort: Permission denied .hg/store/00manifest.i
64 % after update 0, strip 2
64 % after update 0, strip 2
65 abandoned transaction found - run hg recover
65 abandoned transaction found - run hg recover
66 checking changesets
66 checking changesets
67 checking manifests
67 checking manifests
68 manifest@?: rev 2 points to nonexistent changeset 2
68 manifest@?: rev 2 points to nonexistent changeset 2
69 manifest@?: 3362547cdf64 not in changesets
69 manifest@?: 3362547cdf64 not in changesets
70 manifest@?: rev 3 points to nonexistent changeset 3
70 manifest@?: rev 3 points to nonexistent changeset 3
71 manifest@?: 265a85892ecb not in changesets
71 manifest@?: 265a85892ecb not in changesets
72 crosschecking files in changesets and manifests
72 crosschecking files in changesets and manifests
73 c@3: in manifest but not in changeset
73 c@3: in manifest but not in changeset
74 checking files
74 checking files
75 b@?: rev 1 points to nonexistent changeset 2
75 b@?: rev 1 points to nonexistent changeset 2
76 (expected 1)
76 (expected 1)
77 c@?: rev 0 points to nonexistent changeset 3
77 c@?: rev 0 points to nonexistent changeset 3
78 3 files, 2 changesets, 4 total revisions
78 3 files, 2 changesets, 4 total revisions
79 1 warnings encountered!
79 1 warnings encountered!
80 7 integrity errors encountered!
80 7 integrity errors encountered!
81 (first damaged changeset appears to be 3)
81 (first damaged changeset appears to be 3)
82 % journal contents
82 % journal contents
83 00changelog.i
83 00changelog.i
84 00manifest.i
84 00manifest.i
85 data/b.i
85 data/b.i
86 data/c.i
86 data/c.i
87 rolling back interrupted transaction
87 rolling back interrupted transaction
88 checking changesets
88 checking changesets
89 checking manifests
89 checking manifests
90 crosschecking files in changesets and manifests
90 crosschecking files in changesets and manifests
91 checking files
91 checking files
92 2 files, 2 changesets, 2 total revisions
92 2 files, 2 changesets, 2 total revisions
@@ -1,68 +1,64
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # test stripping of filelogs where the linkrev doesn't always increase
3 # test stripping of filelogs where the linkrev doesn't always increase
4
4
5 source $TESTDIR/helpers.sh
5 echo '[extensions]' >> $HGRCPATH
6 echo '[extensions]' >> $HGRCPATH
6 echo 'hgext.mq =' >> $HGRCPATH
7 echo 'hgext.mq =' >> $HGRCPATH
7
8
8 hg init orig
9 hg init orig
9 cd orig
10 cd orig
10
11
11 hidefilename()
12 {
13 sed -e 's/saving bundle to .*strip-backup/saving bundle to strip-backup/'
14 }
15
16 commit()
12 commit()
17 {
13 {
18 hg up -qC null
14 hg up -qC null
19 count=1
15 count=1
20 for i in "$@"; do
16 for i in "$@"; do
21 for f in $i; do
17 for f in $i; do
22 echo $count > $f
18 echo $count > $f
23 done
19 done
24 count=`expr $count + 1`
20 count=`expr $count + 1`
25 done
21 done
26 hg commit -qAm "$*"
22 hg commit -qAm "$*"
27 }
23 }
28
24
29 # 2 1 0 2 0 1 2
25 # 2 1 0 2 0 1 2
30 commit '201 210'
26 commit '201 210'
31
27
32 commit '102 120' '210'
28 commit '102 120' '210'
33
29
34 commit '021'
30 commit '021'
35
31
36 commit '201' '021 120'
32 commit '201' '021 120'
37
33
38 commit '012 021' '102 201' '120 210'
34 commit '012 021' '102 201' '120 210'
39
35
40 commit 'manifest-file'
36 commit 'manifest-file'
41
37
42 commit '102 120' '012 210' '021 201'
38 commit '102 120' '012 210' '021 201'
43
39
44 commit '201 210' '021 120' '012 102'
40 commit '201 210' '021 120' '012 102'
45
41
46 HGUSER=another-user; export HGUSER
42 HGUSER=another-user; export HGUSER
47 commit 'manifest-file'
43 commit 'manifest-file'
48
44
49 commit '012' 'manifest-file'
45 commit '012' 'manifest-file'
50
46
51 cd ..
47 cd ..
52 hg clone -q -U -r -1 -r -2 -r -3 -r -4 -r -6 orig crossed
48 hg clone -q -U -r -1 -r -2 -r -3 -r -4 -r -6 orig crossed
53
49
54 for i in crossed/.hg/store/00manifest.i crossed/.hg/store/data/*.i; do
50 for i in crossed/.hg/store/00manifest.i crossed/.hg/store/data/*.i; do
55 echo $i
51 echo $i
56 hg debugindex $i
52 hg debugindex $i
57 echo
53 echo
58 done
54 done
59
55
60 for i in 0 1 2 3 4; do
56 for i in 0 1 2 3 4; do
61 hg clone -q -U --pull crossed $i
57 hg clone -q -U --pull crossed $i
62 echo "% Trying to strip revision $i"
58 echo "% Trying to strip revision $i"
63 hg --cwd $i strip $i 2>&1 | hidefilename
59 hg --cwd $i strip $i | hidebackup
64 echo "% Verifying"
60 echo "% Verifying"
65 hg --cwd $i verify
61 hg --cwd $i verify
66 echo
62 echo
67 done
63 done
68
64
@@ -1,114 +1,114
1 crossed/.hg/store/00manifest.i
1 crossed/.hg/store/00manifest.i
2 rev offset length base linkrev nodeid p1 p2
2 rev offset length base linkrev nodeid p1 p2
3 0 0 112 0 0 6f105cbb914d 000000000000 000000000000
3 0 0 112 0 0 6f105cbb914d 000000000000 000000000000
4 1 112 56 1 3 1b55917b3699 000000000000 000000000000
4 1 112 56 1 3 1b55917b3699 000000000000 000000000000
5 2 168 123 1 1 8f3d04e263e5 000000000000 000000000000
5 2 168 123 1 1 8f3d04e263e5 000000000000 000000000000
6 3 291 122 1 2 f0ef8726ac4f 000000000000 000000000000
6 3 291 122 1 2 f0ef8726ac4f 000000000000 000000000000
7 4 413 87 4 4 0b76e38b4070 000000000000 000000000000
7 4 413 87 4 4 0b76e38b4070 000000000000 000000000000
8
8
9 crossed/.hg/store/data/012.i
9 crossed/.hg/store/data/012.i
10 rev offset length base linkrev nodeid p1 p2
10 rev offset length base linkrev nodeid p1 p2
11 0 0 3 0 0 b8e02f643373 000000000000 000000000000
11 0 0 3 0 0 b8e02f643373 000000000000 000000000000
12 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
12 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
13 2 6 3 2 2 2661d26c6496 000000000000 000000000000
13 2 6 3 2 2 2661d26c6496 000000000000 000000000000
14
14
15 crossed/.hg/store/data/021.i
15 crossed/.hg/store/data/021.i
16 rev offset length base linkrev nodeid p1 p2
16 rev offset length base linkrev nodeid p1 p2
17 0 0 3 0 0 b8e02f643373 000000000000 000000000000
17 0 0 3 0 0 b8e02f643373 000000000000 000000000000
18 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
18 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
19 2 6 3 2 1 2661d26c6496 000000000000 000000000000
19 2 6 3 2 1 2661d26c6496 000000000000 000000000000
20
20
21 crossed/.hg/store/data/102.i
21 crossed/.hg/store/data/102.i
22 rev offset length base linkrev nodeid p1 p2
22 rev offset length base linkrev nodeid p1 p2
23 0 0 3 0 1 b8e02f643373 000000000000 000000000000
23 0 0 3 0 1 b8e02f643373 000000000000 000000000000
24 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
24 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
25 2 6 3 2 2 2661d26c6496 000000000000 000000000000
25 2 6 3 2 2 2661d26c6496 000000000000 000000000000
26
26
27 crossed/.hg/store/data/120.i
27 crossed/.hg/store/data/120.i
28 rev offset length base linkrev nodeid p1 p2
28 rev offset length base linkrev nodeid p1 p2
29 0 0 3 0 1 b8e02f643373 000000000000 000000000000
29 0 0 3 0 1 b8e02f643373 000000000000 000000000000
30 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
30 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
31 2 6 3 2 0 2661d26c6496 000000000000 000000000000
31 2 6 3 2 0 2661d26c6496 000000000000 000000000000
32
32
33 crossed/.hg/store/data/201.i
33 crossed/.hg/store/data/201.i
34 rev offset length base linkrev nodeid p1 p2
34 rev offset length base linkrev nodeid p1 p2
35 0 0 3 0 2 b8e02f643373 000000000000 000000000000
35 0 0 3 0 2 b8e02f643373 000000000000 000000000000
36 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
36 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
37 2 6 3 2 1 2661d26c6496 000000000000 000000000000
37 2 6 3 2 1 2661d26c6496 000000000000 000000000000
38
38
39 crossed/.hg/store/data/210.i
39 crossed/.hg/store/data/210.i
40 rev offset length base linkrev nodeid p1 p2
40 rev offset length base linkrev nodeid p1 p2
41 0 0 3 0 2 b8e02f643373 000000000000 000000000000
41 0 0 3 0 2 b8e02f643373 000000000000 000000000000
42 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
42 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
43 2 6 3 2 0 2661d26c6496 000000000000 000000000000
43 2 6 3 2 0 2661d26c6496 000000000000 000000000000
44
44
45 crossed/.hg/store/data/manifest-file.i
45 crossed/.hg/store/data/manifest-file.i
46 rev offset length base linkrev nodeid p1 p2
46 rev offset length base linkrev nodeid p1 p2
47 0 0 3 0 3 b8e02f643373 000000000000 000000000000
47 0 0 3 0 3 b8e02f643373 000000000000 000000000000
48 1 3 3 1 4 5d9299349fc0 000000000000 000000000000
48 1 3 3 1 4 5d9299349fc0 000000000000 000000000000
49
49
50 % Trying to strip revision 0
50 % Trying to strip revision 0
51 saving bundle to strip-backup/cbb8c2f0a2e3-backup
51 saved backup bundle to
52 adding branch
52 adding branch
53 adding changesets
53 adding changesets
54 adding manifests
54 adding manifests
55 adding file changes
55 adding file changes
56 added 4 changesets with 15 changes to 7 files (+3 heads)
56 added 4 changesets with 15 changes to 7 files (+3 heads)
57 % Verifying
57 % Verifying
58 checking changesets
58 checking changesets
59 checking manifests
59 checking manifests
60 crosschecking files in changesets and manifests
60 crosschecking files in changesets and manifests
61 checking files
61 checking files
62 7 files, 4 changesets, 15 total revisions
62 7 files, 4 changesets, 15 total revisions
63
63
64 % Trying to strip revision 1
64 % Trying to strip revision 1
65 saving bundle to strip-backup/124ecc0cbec9-backup
65 saved backup bundle to
66 adding branch
66 adding branch
67 adding changesets
67 adding changesets
68 adding manifests
68 adding manifests
69 adding file changes
69 adding file changes
70 added 3 changesets with 12 changes to 7 files (+3 heads)
70 added 3 changesets with 12 changes to 7 files (+3 heads)
71 % Verifying
71 % Verifying
72 checking changesets
72 checking changesets
73 checking manifests
73 checking manifests
74 crosschecking files in changesets and manifests
74 crosschecking files in changesets and manifests
75 checking files
75 checking files
76 7 files, 4 changesets, 14 total revisions
76 7 files, 4 changesets, 14 total revisions
77
77
78 % Trying to strip revision 2
78 % Trying to strip revision 2
79 saving bundle to strip-backup/f6439b304a1a-backup
79 saved backup bundle to
80 adding branch
80 adding branch
81 adding changesets
81 adding changesets
82 adding manifests
82 adding manifests
83 adding file changes
83 adding file changes
84 added 2 changesets with 8 changes to 6 files (+2 heads)
84 added 2 changesets with 8 changes to 6 files (+2 heads)
85 % Verifying
85 % Verifying
86 checking changesets
86 checking changesets
87 checking manifests
87 checking manifests
88 crosschecking files in changesets and manifests
88 crosschecking files in changesets and manifests
89 checking files
89 checking files
90 7 files, 4 changesets, 14 total revisions
90 7 files, 4 changesets, 14 total revisions
91
91
92 % Trying to strip revision 3
92 % Trying to strip revision 3
93 saving bundle to strip-backup/6e54ec5db740-backup
93 saved backup bundle to
94 adding branch
94 adding branch
95 adding changesets
95 adding changesets
96 adding manifests
96 adding manifests
97 adding file changes
97 adding file changes
98 added 1 changesets with 1 changes to 2 files (+1 heads)
98 added 1 changesets with 1 changes to 2 files (+1 heads)
99 % Verifying
99 % Verifying
100 checking changesets
100 checking changesets
101 checking manifests
101 checking manifests
102 crosschecking files in changesets and manifests
102 crosschecking files in changesets and manifests
103 checking files
103 checking files
104 7 files, 4 changesets, 19 total revisions
104 7 files, 4 changesets, 19 total revisions
105
105
106 % Trying to strip revision 4
106 % Trying to strip revision 4
107 saving bundle to strip-backup/9147ea23c156-backup
107 saved backup bundle to
108 % Verifying
108 % Verifying
109 checking changesets
109 checking changesets
110 checking manifests
110 checking manifests
111 crosschecking files in changesets and manifests
111 crosschecking files in changesets and manifests
112 checking files
112 checking files
113 7 files, 4 changesets, 19 total revisions
113 7 files, 4 changesets, 19 total revisions
114
114
General Comments 0
You need to be logged in to leave comments. Login now