summaryrefslogtreecommitdiff
path: root/tests/test-mq-git.t
blob: f5fcf793a32d91938108633715ba35452e73347e (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Test the plumbing of mq.git option
# Automatic upgrade itself is tested elsewhere.

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "mq=" >> $HGRCPATH
  $ echo "[diff]" >> $HGRCPATH
  $ echo "nodates=1" >> $HGRCPATH

  $ hg init repo-auto
  $ cd repo-auto

git=auto: regular patch creation:

  $ echo a > a
  $ hg add a
  $ hg qnew -d '0 0' -f adda

  $ cat .hg/patches/adda
  # HG changeset patch
  # Parent 0000000000000000000000000000000000000000
  # Date 0 0
  
  diff -r 000000000000 -r ef8dafc9fa4c a
  --- /dev/null
  +++ b/a
  @@ -0,0 +1,1 @@
  +a

git=auto: git patch creation with copy:

  $ hg cp a b
  $ hg qnew -d '0 0' -f copy

  $ cat .hg/patches/copy
  # HG changeset patch
  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
  # Date 0 0
  
  diff --git a/a b/b
  copy from a
  copy to b

git=auto: git patch when using --git:

  $ echo regular > regular
  $ hg add regular
  $ hg qnew -d '0 0' --git -f git

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
  # Date 0 0
  
  diff --git a/regular b/regular
  new file mode 100644
  --- /dev/null
  +++ b/regular
  @@ -0,0 +1,1 @@
  +regular

git=auto: regular patch after qrefresh without --git:

  $ hg qrefresh -d '0 0'

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
  # Date 0 0
  
  diff -r 99586d5f048c regular
  --- /dev/null
  +++ b/regular
  @@ -0,0 +1,1 @@
  +regular

  $ cd ..

  $ hg init repo-keep
  $ cd repo-keep
  $ echo '[mq]' > .hg/hgrc
  $ echo 'git = KEEP' >> .hg/hgrc

git=keep: git patch with --git:

  $ echo a > a
  $ hg add a
  $ hg qnew -d '0 0' -f --git git

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 0000000000000000000000000000000000000000
  # Date 0 0
  
  diff --git a/a b/a
  new file mode 100644
  --- /dev/null
  +++ b/a
  @@ -0,0 +1,1 @@
  +a

git=keep: git patch after qrefresh without --git:

  $ echo a >> a
  $ hg qrefresh -d '0 0'

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 0000000000000000000000000000000000000000
  # Date 0 0
  
  diff --git a/a b/a
  new file mode 100644
  --- /dev/null
  +++ b/a
  @@ -0,0 +1,2 @@
  +a
  +a
  $ cd ..

  $ hg init repo-yes
  $ cd repo-yes
  $ echo '[mq]' > .hg/hgrc
  $ echo 'git = yes' >> .hg/hgrc

git=yes: git patch:

  $ echo a > a
  $ hg add a
  $ hg qnew -d '0 0' -f git

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 0000000000000000000000000000000000000000
  # Date 0 0
  
  diff --git a/a b/a
  new file mode 100644
  --- /dev/null
  +++ b/a
  @@ -0,0 +1,1 @@
  +a

git=yes: git patch after qrefresh:

  $ echo a >> a
  $ hg qrefresh -d '0 0'

  $ cat .hg/patches/git
  # HG changeset patch
  # Parent 0000000000000000000000000000000000000000
  # Date 0 0
  
  diff --git a/a b/a
  new file mode 100644
  --- /dev/null
  +++ b/a
  @@ -0,0 +1,2 @@
  +a
  +a
  $ cd ..

  $ hg init repo-no
  $ cd repo-no
  $ echo '[diff]' > .hg/hgrc
  $ echo 'git = True' >> .hg/hgrc
  $ echo '[mq]' > .hg/hgrc
  $ echo 'git = False' >> .hg/hgrc

git=no: regular patch with copy:

  $ echo a > a
  $ hg add a
  $ hg qnew -d '0 0' -f adda
  $ hg cp a b
  $ hg qnew -d '0 0' -f regular

  $ cat .hg/patches/regular
  # HG changeset patch
  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
  # Date 0 0
  
  diff -r ef8dafc9fa4c -r a70404f79ba3 b
  --- /dev/null
  +++ b/b
  @@ -0,0 +1,1 @@
  +a

git=no: regular patch after qrefresh with copy:

  $ hg cp a c
  $ hg qrefresh -d '0 0'

  $ cat .hg/patches/regular
  # HG changeset patch
  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
  # Date 0 0
  
  diff -r ef8dafc9fa4c b
  --- /dev/null
  +++ b/b
  @@ -0,0 +1,1 @@
  +a
  diff -r ef8dafc9fa4c c
  --- /dev/null
  +++ b/c
  @@ -0,0 +1,1 @@
  +a

  $ cd ..