Mercurial > hg
comparison mercurial/discovery.py @ 15292:7fa471248185 stable
discovery: Fix error print mentioning a 'None' branch
When talking to old server discovery use heads of the 'None' branch to refer to
topological heads. This use of None should never make it to the end user.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 17 Oct 2011 11:37:59 +0200 |
parents | 4276e3202585 |
children | fa47291b3f1f 9bea3aed6ee1 |
comparison
equal
deleted
inserted
replaced
15291:1fead3ad7874 | 15292:7fa471248185 |
---|---|
159 newhs = set(newmap[branch]) | 159 newhs = set(newmap[branch]) |
160 oldhs = set(oldmap[branch]) | 160 oldhs = set(oldmap[branch]) |
161 if len(newhs) > len(oldhs): | 161 if len(newhs) > len(oldhs): |
162 dhs = list(newhs - oldhs) | 162 dhs = list(newhs - oldhs) |
163 if error is None: | 163 if error is None: |
164 if branch != 'default': | 164 if branch not in ('default', None): |
165 error = _("push creates new remote head %s " | 165 error = _("push creates new remote head %s " |
166 "on branch '%s'!") % (short(dhs[0]), branch) | 166 "on branch '%s'!") % (short(dhs[0]), branch) |
167 else: | 167 else: |
168 error = _("push creates new remote head %s!" | 168 error = _("push creates new remote head %s!" |
169 ) % short(dhs[0]) | 169 ) % short(dhs[0]) |
171 hint = _("you should pull and merge or " | 171 hint = _("you should pull and merge or " |
172 "use push -f to force") | 172 "use push -f to force") |
173 else: | 173 else: |
174 hint = _("did you forget to merge? " | 174 hint = _("did you forget to merge? " |
175 "use push -f to force") | 175 "use push -f to force") |
176 repo.ui.note("new remote heads on branch '%s'\n" % branch) | 176 if branch is not None: |
177 repo.ui.note("new remote heads on branch '%s'\n" % branch) | |
177 for h in dhs: | 178 for h in dhs: |
178 repo.ui.note("new remote head %s\n" % short(h)) | 179 repo.ui.note("new remote head %s\n" % short(h)) |
179 if error: | 180 if error: |
180 raise util.Abort(error, hint=hint) | 181 raise util.Abort(error, hint=hint) |
181 | 182 |