Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: infra/libs/git2/repo.py

Issue 477623003: Add git subtree daemon service. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@add_dtree_support
Patch Set: address comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/libs/git2/ref.py ('k') | infra/libs/git2/test/ref_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import errno 6 import errno
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import subprocess 10 import subprocess
(...skipping 18 matching lines...) Expand all
29 29
30 def __init__(self, url): 30 def __init__(self, url):
31 self.dry_run = False 31 self.dry_run = False
32 self.repos_dir = None 32 self.repos_dir = None
33 33
34 self._url = url 34 self._url = url
35 self._repo_path = None 35 self._repo_path = None
36 self._commit_cache = collections.OrderedDict() 36 self._commit_cache = collections.OrderedDict()
37 self._log = LOGGER.getChild('Repo') 37 self._log = LOGGER.getChild('Repo')
38 38
39 def __hash__(self):
40 return hash((self._url, self._repo_path))
41
39 def __getitem__(self, ref): 42 def __getitem__(self, ref):
40 """Get a Ref attached to this Repo.""" 43 """Get a Ref attached to this Repo."""
41 return Ref(self, ref) 44 return Ref(self, ref)
42 45
43 # Accessors 46 # Accessors
44 # pylint: disable=W0212 47 # pylint: disable=W0212
45 url = property(lambda self: self._url) 48 url = property(lambda self: self._url)
46 repo_path = property(lambda self: self._repo_path) 49 repo_path = property(lambda self: self._repo_path)
47 50
48 def reify(self, share_from=None): 51 def reify(self, share_from=None):
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 """ 194 """
192 if not refs_and_commits: 195 if not refs_and_commits:
193 return 196 return
194 refspec = [ 197 refspec = [
195 '%s:%s' % (c.hsh, r.ref) 198 '%s:%s' % (c.hsh, r.ref)
196 for r, c in refs_and_commits.iteritems() 199 for r, c in refs_and_commits.iteritems()
197 ] 200 ]
198 self.run('push', 'origin', *refspec) 201 self.run('push', 'origin', *refspec)
199 for r, c in refs_and_commits.iteritems(): 202 for r, c in refs_and_commits.iteritems():
200 r.update_to(c) 203 r.update_to(c)
OLDNEW
« no previous file with comments | « infra/libs/git2/ref.py ('k') | infra/libs/git2/test/ref_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698