prepush: rename variables, refactor
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 07 Feb 2010 00:43:22 +0100
changeset 10353 36b6b5ef7820
parent 10352 66d954e76ffb
child 10354 844d83da2da9
prepush: rename variables, refactor
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sat Feb 06 10:51:50 2010 +0100
+++ b/mercurial/localrepo.py	Sun Feb 07 00:43:22 2010 +0100
@@ -1558,25 +1558,18 @@
 
             if remote_heads != [nullid]:
                 if remote.capable('branchmap'):
-                    localhds = {}
+                    remotebrheads = remote.branchmap()
+
                     if not revs:
-                        localhds = self.branchmap()
+                        localbrheads = self.branchmap()
                     else:
+                        localbrheads = {}
                         for n in heads:
                             branch = self[n].branch()
-                            if branch in localhds:
-                                localhds[branch].append(n)
-                            else:
-                                localhds[branch] = [n]
-
-                    remotehds = remote.branchmap()
+                            localbrheads.setdefault(branch, []).append(n)
 
-                    for lh in localhds:
-                        if lh in remotehds:
-                            rheads = remotehds[lh]
-                        else:
-                            rheads = []
-                        lheads = localhds[lh]
+                    for branch, lheads in localbrheads.iteritems():
+                        rheads = remotebrheads.get(branch, [])
                         if not checkbranch(lheads, rheads, update):
                             return None, 0
                 else: