##// END OF EJS Templates
discovery: prevent crash on unknown remote heads with old repo (issue4337)...
Pierre-Yves David -
r22178:70383c69 stable
parent child Browse files
Show More
@@ -217,6 +217,7 def _oldheadssummary(repo, remoteheads,
217 # This explains why the new head are very simple to compute.
217 # This explains why the new head are very simple to compute.
218 r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing)
218 r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing)
219 newheads = list(c.node() for c in r)
219 newheads = list(c.node() for c in r)
220 # set some unsynced head to issue the "unsynced changes" warning
220 unsynced = inc and set([None]) or set()
221 unsynced = inc and set([None]) or set()
221 return {None: (oldheads, newheads, unsynced)}
222 return {None: (oldheads, newheads, unsynced)}
222
223
@@ -313,12 +314,18 def checkheads(repo, remote, outgoing, r
313 newhs = candidate_newhs
314 newhs = candidate_newhs
314 unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
315 unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
315 if unsynced:
316 if unsynced:
316 if len(unsynced) <= 4 or repo.ui.verbose:
317 if None in unsynced:
318 # old remote, no heads data
319 heads = None
320 elif len(unsynced) <= 4 or repo.ui.verbose:
317 heads = ' '.join(short(h) for h in unsynced)
321 heads = ' '.join(short(h) for h in unsynced)
318 else:
322 else:
319 heads = (' '.join(short(h) for h in unsynced[:4]) +
323 heads = (' '.join(short(h) for h in unsynced[:4]) +
320 ' ' + _("and %s others") % (len(unsynced) - 4))
324 ' ' + _("and %s others") % (len(unsynced) - 4))
321 if branch is None:
325 if heads is None:
326 repo.ui.status(_("remote has heads that are "
327 "not known locally\n"))
328 elif branch is None:
322 repo.ui.status(_("remote has heads that are "
329 repo.ui.status(_("remote has heads that are "
323 "not known locally: %s\n") % heads)
330 "not known locally: %s\n") % heads)
324 else:
331 else:
General Comments 0
You need to be logged in to leave comments. Login now