##// END OF EJS Templates
bookmarks: allow existing remote bookmarks to become heads when pushing
Levi Bard -
r16835:4267c840 default
parent child Browse files
Show More
@@ -226,11 +226,20 b' def checkheads(repo, remote, outgoing, r'
226 226 # If there are more heads after the push than before, a suitable
227 227 # error message, depending on unsynced status, is displayed.
228 228 error = None
229 remotebookmarks = remote.listkeys('bookmarks')
230 localbookmarks = repo._bookmarks
231
229 232 for branch in branches:
230 233 newhs = set(newmap[branch])
231 234 oldhs = set(oldmap[branch])
235 dhs = None
232 236 if len(newhs) > len(oldhs):
233 dhs = list(newhs - oldhs)
237 # strip updates to existing remote heads from the new heads list
238 bookmarkedheads = set([repo[bm].node() for bm in localbookmarks
239 if bm in remotebookmarks and
240 remote[bm] == repo[bm].ancestor(remote[bm])])
241 dhs = list(newhs - bookmarkedheads - oldhs)
242 if dhs:
234 243 if error is None:
235 244 if branch not in ('default', None):
236 245 error = _("push creates new remote head %s "
@@ -149,6 +149,45 b' divergent bookmarks'
149 149 Y 0:4e3505fd9583
150 150 Z 1:0d2164f0ce0d
151 151
152 update a remote bookmark from a non-head to a head
153
154 $ hg up -q Y
155 $ echo c3 > f2
156 $ hg ci -Am3
157 adding f2
158 created new head
159 $ hg push ../a
160 pushing to ../a
161 searching for changes
162 adding changesets
163 adding manifests
164 adding file changes
165 added 1 changesets with 1 changes to 1 files (+1 heads)
166 updating bookmark Y
167 $ hg -R ../a book
168 * X 1:0d2164f0ce0d
169 Y 3:f6fc62dde3c0
170 Z 1:0d2164f0ce0d
171
172 diverging a remote bookmark fails
173
174 $ hg up -q 4e3505fd9583
175 $ echo c4 > f2
176 $ hg ci -Am4
177 adding f2
178 created new head
179 $ hg book -f Y
180 $ hg push ../a
181 pushing to ../a
182 searching for changes
183 abort: push creates new remote head 4efff6d98829!
184 (did you forget to merge? use push -f to force)
185 [255]
186 $ hg -R ../a book
187 * X 1:0d2164f0ce0d
188 Y 3:f6fc62dde3c0
189 Z 1:0d2164f0ce0d
190
152 191 hgweb
153 192
154 193 $ cat <<EOF > .hg/hgrc
@@ -166,7 +205,7 b' hgweb'
166 205 phases
167 206 namespaces
168 207 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
169 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
208 Y 4efff6d98829d9c824c621afd6e3f01865f5439f
170 209 foobar 9b140be1080824d768c5a4691a564088eede71f9
171 210 Z 0d2164f0ce0d8f1d6f94351eba04b794909be66c
172 211 foo 0000000000000000000000000000000000000000
@@ -202,12 +241,12 b' hgweb'
202 241 adding changesets
203 242 adding manifests
204 243 adding file changes
205 added 3 changesets with 3 changes to 3 files (+1 heads)
244 added 5 changesets with 5 changes to 3 files (+3 heads)
206 245 updating to branch default
207 246 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 247 $ hg -R cloned-bookmarks bookmarks
209 248 X 1:9b140be10808
210 Y 0:4e3505fd9583
249 Y 4:4efff6d98829
211 250 Z 2:0d2164f0ce0d
212 251 foo -1:000000000000
213 252 foobar 1:9b140be10808
General Comments 0
You need to be logged in to leave comments. Login now