Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

remane team to old_team to keep convention in sync.run method, using …

…add instead of update on sets
  • Loading branch information...
commit e48de49646fc5c9bd4b2e70e0cc8f2d8e6018463 1 parent e098f9d
Rok Garbas authored July 03, 2011

Showing 1 changed file with 19 additions and 19 deletions. Show diff stats Hide diff stats

  1. 38  githubcollective/sync.py
38  githubcollective/sync.py
@@ -58,55 +58,55 @@ def run(self, new, old):
58 58
             print 'TEAMS'
59 59
         for team_name in new.teams - to_remove:
60 60
 
61  
-            team = old.get_team(team_name)
62  
-            if team is None:
  61
+            old_team = old.get_team(team_name)
  62
+            if old_team is None:
63 63
                 continue
64 64
             new_team = new.get_team(team_name)
65  
-            new_team.id = team.id
  65
+            new_team.id = old_team.id
66 66
 
67 67
             # UPDATE TEAM PERMISSION
68  
-            if new_team.permission != team.permission:
  68
+            if new_team.permission != old_team.permission:
69 69
                 self.edit_team(old, new_team)
70 70
                 if self.verbose:
71 71
                     print '    - %s - UPDATE PERMISSION: %s -> %s' % (
72  
-                            team.name, team.permission, new_team.permission)
  72
+                            old_team.name, old_team.permission, new_team.permission)
73 73
 
74 74
 
75 75
             # ADD MEMBERS
76  
-            to_add = set(new_team.members) - set(team.members)
  76
+            to_add = new_team.members - old_team.members
77 77
             if to_add:
78 78
                 if self.verbose:
79  
-                    print '    - %s - ADDED MEMBERS:' % team.name
  79
+                    print '    - %s - ADDED MEMBERS:' % team_name
80 80
                 for member in to_add:
81  
-                    self.add_team_member(old, team, member)
  81
+                    self.add_team_member(old, old_team, member)
82 82
                     print '        - %s' % member
83 83
 
84 84
 
85 85
             # REMOVE MEMBERS
86  
-            to_remove = set(team.members) - set(new_team.members)
  86
+            to_remove = old_team.members - new_team.members
87 87
             if to_remove:
88 88
                 if self.verbose:
89  
-                    print '    - %s - REMOVED MEMBERS:' % team.name
  89
+                    print '    - %s - REMOVED MEMBERS:' % team_name
90 90
                 for member in to_remove:
91  
-                    self.remove_team_member(old, team, member)
  91
+                    self.remove_team_member(old, old_team, member)
92 92
                     print '        - %s' % member
93 93
 
94 94
             # ADD REPOS 
95  
-            to_add = new_team.repos - team.repos
  95
+            to_add = new_team.repos - old_team.repos
96 96
             if to_add:
97 97
                 if self.verbose:
98  
-                    print '    - %s - ADDED REPOS:' % team.name
  98
+                    print '    - %s - ADDED REPOS:' % team_name
99 99
                 for repo in to_add:
100  
-                    self.add_team_repo(old, team, repo)
  100
+                    self.add_team_repo(old, old_team, repo)
101 101
                     print '        - %s' % repo
102 102
 
103 103
             # REMOVE REPOS
104  
-            to_remove = team.repos - new_team.repos
  104
+            to_remove = old_team.repos - new_team.repos
105 105
             if to_remove:
106 106
                 if self.verbose:
107  
-                    print '    - %s - REMOVED REPOS:' % team.name
  107
+                    print '    - %s - REMOVED REPOS:' % team_name
108 108
                 for repo in to_remove:
109  
-                    self.remove_team_repo(old, team, repo)
  109
+                    self.remove_team_repo(old, old_team, repo)
110 110
                     print '        - %s' % repo
111 111
 
112 112
         if self.verbose:
@@ -156,7 +156,7 @@ def remove_team(self, config, team):
156 156
 
157 157
     def add_team_member(self, config, team, member):
158 158
         team = config.get_team(team.name)
159  
-        team.members.update([member])
  159
+        team.members.add(member)
160 160
         return self.github._gh_org_add_team_member(team.id, member)
161 161
 
162 162
     def remove_team_member(self, config, team, member):
@@ -166,7 +166,7 @@ def remove_team_member(self, config, team, member):
166 166
 
167 167
     def add_team_repo(self, config, team, repo):
168 168
         team = config.get_team(team.name)
169  
-        team.repos.update([repo])
  169
+        team.repos.add(repo)
170 170
         return self.github._gh_org_add_team_repo(team.id, repo)
171 171
 
172 172
     def remove_team_repo(self, config, team, repo):

0 notes on commit e48de49

Please sign in to comment.
Something went wrong with that request. Please try again.