Commits

WAKAYAMA shirou committed 0d69c79

revise getpeer function to try/except style.

  • Participants
  • Parent commits 870d622

Comments (0)

Files changed (1)

         return repo.findincoming
 
 def getpeer(ui, opts, source):
-    # Since 2.3 (1ac628cd7113)
-    peer = getattr(hg, 'peer', None)
-    if peer:
-        return peer(ui, opts, source)
-    return hg.repository(ui, source)
+    try:
+        peer = hg.peer
+        if peer:
+            return peer(ui, opts, source)
+        else:
+            error = _("Could not get peer.")
+            raise util.Abort(error)
+    except AttributeError:
+        return hg.repository(ui, source)
 
 def capable(repo, name):
     try: