changeset 10353:36b6b5ef7820

prepush: rename variables, refactor
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 07 Feb 2010 00:43:22 +0100
parents 66d954e76ffb
children 844d83da2da9
files mercurial/localrepo.py
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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: