Mercurial > hg
comparison mercurial/discovery.py @ 20398:2bc520bd0ce0
discovery: improve "note: unsynced remote changes!" warning
This note (which actually is a warning) frequently caused confusion.
"unsynced" is not a well established user-facing concept in Mercurial and the
message was not very specific or helpful.
Instead, show a messages like:
remote has heads on branch 'default' that are not known locally: 6c0482d977a3
and show it before aborting on "push creates new remote head". This will also
give more of a hint in the case where the branch has been closed remotely and
'hg heads' thus not would show any new heads after pulling.
A similar (but actually very different) message was addressed in 6b618aa08b6e.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 06 Feb 2014 02:19:38 +0100 |
parents | fff0a71f8177 |
children | 47f25736d006 |
comparison
equal
deleted
inserted
replaced
20397:d7e78e6d97bd | 20398:2bc520bd0ce0 |
---|---|
266 | 266 |
267 # 3. Check for new heads. | 267 # 3. Check for new heads. |
268 # If there are more heads after the push than before, a suitable | 268 # If there are more heads after the push than before, a suitable |
269 # error message, depending on unsynced status, is displayed. | 269 # error message, depending on unsynced status, is displayed. |
270 error = None | 270 error = None |
271 unsynced = False | |
272 allmissing = set(outgoing.missing) | 271 allmissing = set(outgoing.missing) |
273 allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common)) | 272 allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common)) |
274 allfuturecommon.update(allmissing) | 273 allfuturecommon.update(allmissing) |
275 for branch, heads in sorted(headssum.iteritems()): | 274 for branch, heads in sorted(headssum.iteritems()): |
276 remoteheads, newheads, unsyncedheads = heads | 275 remoteheads, newheads, unsyncedheads = heads |
310 break | 309 break |
311 else: | 310 else: |
312 newhs.add(nh) | 311 newhs.add(nh) |
313 else: | 312 else: |
314 newhs = candidate_newhs | 313 newhs = candidate_newhs |
315 if [h for h in unsyncedheads if h not in discardedheads]: | 314 unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) |
316 unsynced = True | 315 if unsynced: |
316 heads = ' '.join(short(h) for h in unsynced) | |
317 if branch is None: | |
318 repo.ui.warn(_("remote has heads that are not known locally: " | |
319 "%s\n") % heads) | |
320 else: | |
321 repo.ui.warn(_("remote has heads on branch '%s' that are " | |
322 "not known locally: %s\n") % (branch, heads)) | |
317 if remoteheads is None: | 323 if remoteheads is None: |
318 if len(newhs) > 1: | 324 if len(newhs) > 1: |
319 dhs = list(newhs) | 325 dhs = list(newhs) |
320 if error is None: | 326 if error is None: |
321 error = (_("push creates new branch '%s' " | 327 error = (_("push creates new branch '%s' " |
348 repo.ui.note(_("new remote heads on branch '%s':\n") % branch) | 354 repo.ui.note(_("new remote heads on branch '%s':\n") % branch) |
349 for h in dhs: | 355 for h in dhs: |
350 repo.ui.note((" %s\n") % short(h)) | 356 repo.ui.note((" %s\n") % short(h)) |
351 if error: | 357 if error: |
352 raise util.Abort(error, hint=hint) | 358 raise util.Abort(error, hint=hint) |
353 | |
354 # 6. Check for unsynced changes on involved branches. | |
355 if unsynced: | |
356 repo.ui.warn(_("note: unsynced remote changes!\n")) |