summaryrefslogtreecommitdiff
path: root/tests/test-mq-safety.t
blob: d184d8ea3c81f123c321e1ffed417268a6489908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
  $ echo '[extensions]' >> $HGRCPATH
  $ echo 'mq =' >> $HGRCPATH

  $ hg init repo
  $ cd repo

  $ echo foo > foo
  $ hg ci -qAm 'add a file'

  $ hg qinit

  $ hg qnew foo
  $ echo foo >> foo
  $ hg qrefresh -m 'append foo'

  $ hg qnew bar
  $ echo bar >> foo
  $ hg qrefresh -m 'append bar'


try to commit on top of a patch

  $ echo quux >> foo
  $ hg ci -m 'append quux'
  abort: cannot commit over an applied mq patch
  [255]


cheat a bit...

  $ mv .hg/patches .hg/patches2
  $ hg ci -m 'append quux'
  $ mv .hg/patches2 .hg/patches


qpop/qrefresh on the wrong revision

  $ hg qpop
  abort: popping would remove a revision not managed by this patch queue
  [255]
  $ hg qpop -n patches
  using patch queue: $TESTTMP/repo/.hg/patches
  abort: popping would remove a revision not managed by this patch queue
  [255]
  $ hg qrefresh
  abort: working directory revision is not qtip
  [255]

  $ hg up -C qtip
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg qpop
  abort: popping would remove a revision not managed by this patch queue
  [255]
  $ hg qrefresh
  abort: cannot refresh a revision with children
  [255]
  $ hg tip --template '{rev} {desc}\n'
  3 append quux


qpush warning branchheads

  $ cd ..
  $ hg init branchy
  $ cd branchy
  $ echo q > q
  $ hg add q
  $ hg qnew -f qp
  $ hg qpop
  popping qp
  patch queue now empty
  $ echo a > a
  $ hg ci -Ama
  adding a
  $ hg up null
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg branch b
  marked working directory as branch b
  $ echo c > c
  $ hg ci -Amc
  adding c
  $ hg merge default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -mmerge
  $ hg up default
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg log
  changeset:   2:65309210bf4e
  branch:      b
  tag:         tip
  parent:      1:707adb4c8ae1
  parent:      0:cb9a9f314b8b
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     merge
  
  changeset:   1:707adb4c8ae1
  branch:      b
  parent:      -1:000000000000
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     c
  
  changeset:   0:cb9a9f314b8b
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     a
  
  $ hg qpush
  applying qp
  now at: qp

Testing applied patches, push and --force

  $ cd ..
  $ hg init forcepush
  $ cd forcepush
  $ echo a > a
  $ hg ci -Am adda
  adding a
  $ echo a >> a
  $ hg ci -m changea
  $ hg up 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg branch branch
  marked working directory as branch branch
  $ echo b > b
  $ hg ci -Am addb
  adding b
  $ hg up 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg --cwd .. clone -r 0 forcepush forcepush2
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  updating to branch default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo a >> a
  $ hg qnew patch

Pushing applied patch with --rev without --force

  $ hg push -r default ../forcepush2
  pushing to ../forcepush2
  abort: source has mq patches applied
  [255]

Pushing applied patch with branchhash, without --force

  $ hg push ../forcepush2#default
  pushing to ../forcepush2
  abort: source has mq patches applied
  [255]

Pushing revs excluding applied patch

  $ hg push --new-branch -r branch -r 2 ../forcepush2
  pushing to ../forcepush2
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files

Pushing applied patch with --force

  $ hg push --force -r default ../forcepush2
  pushing to ../forcepush2
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files (+1 heads)