OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
6 | 6 |
7 from __future__ import print_function | 7 from __future__ import print_function |
8 | 8 |
9 import errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 rev_str = ' at %s' % revision | 349 rev_str = ' at %s' % revision |
350 files = [] if file_list is not None else None | 350 files = [] if file_list is not None else None |
351 | 351 |
352 printed_path = False | 352 printed_path = False |
353 verbose = [] | 353 verbose = [] |
354 if options.verbose: | 354 if options.verbose: |
355 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 355 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) |
356 verbose = ['--verbose'] | 356 verbose = ['--verbose'] |
357 printed_path = True | 357 printed_path = True |
358 | 358 |
| 359 if not managed: |
| 360 self.Print('________ unmanaged solution; skipping %s' % self.relpath) |
| 361 try: |
| 362 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
| 363 except subprocess2.CalledProcessError: |
| 364 return None |
| 365 |
359 url = self._CreateOrUpdateCache(url, options) | 366 url = self._CreateOrUpdateCache(url, options) |
360 | 367 |
361 if revision.startswith('refs/'): | 368 if revision.startswith('refs/'): |
362 rev_type = "branch" | 369 rev_type = "branch" |
363 elif revision.startswith(self.remote + '/'): | 370 elif revision.startswith(self.remote + '/'): |
364 # Rewrite remote refs to their local equivalents. | 371 # Rewrite remote refs to their local equivalents. |
365 revision = 'refs/remotes/' + revision | 372 revision = 'refs/remotes/' + revision |
366 rev_type = "branch" | 373 rev_type = "branch" |
367 else: | 374 else: |
368 # hash is also a tag, only make a distinction at checkout | 375 # hash is also a tag, only make a distinction at checkout |
(...skipping 13 matching lines...) Expand all Loading... |
382 self._Capture(['checkout', '--quiet', deps_branch]) | 389 self._Capture(['checkout', '--quiet', deps_branch]) |
383 if file_list is not None: | 390 if file_list is not None: |
384 files = self._Capture(['ls-files']).splitlines() | 391 files = self._Capture(['ls-files']).splitlines() |
385 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) | 392 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
386 if not verbose: | 393 if not verbose: |
387 # Make the output a little prettier. It's nice to have some whitespace | 394 # Make the output a little prettier. It's nice to have some whitespace |
388 # between projects when cloning. | 395 # between projects when cloning. |
389 self.Print('') | 396 self.Print('') |
390 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 397 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
391 | 398 |
392 if not managed: | |
393 self._UpdateBranchHeads(options, fetch=False) | |
394 self.Print('________ unmanaged solution; skipping %s' % self.relpath) | |
395 return self._Capture(['rev-parse', '--verify', 'HEAD']) | |
396 | |
397 # See if the url has changed (the unittests use git://foo for the url, let | 399 # See if the url has changed (the unittests use git://foo for the url, let |
398 # that through). | 400 # that through). |
399 current_url = self._Capture(['config', 'remote.%s.url' % self.remote]) | 401 current_url = self._Capture(['config', 'remote.%s.url' % self.remote]) |
400 return_early = False | 402 return_early = False |
401 # TODO(maruel): Delete url != 'git://foo' since it's just to make the | 403 # TODO(maruel): Delete url != 'git://foo' since it's just to make the |
402 # unit test pass. (and update the comment above) | 404 # unit test pass. (and update the comment above) |
403 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. | 405 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. |
404 # This allows devs to use experimental repos which have a different url | 406 # This allows devs to use experimental repos which have a different url |
405 # but whose branch(s) are the same as official repos. | 407 # but whose branch(s) are the same as official repos. |
406 if (current_url.rstrip('/') != url.rstrip('/') and | 408 if (current_url.rstrip('/') != url.rstrip('/') and |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 new_command.append('--force') | 1485 new_command.append('--force') |
1484 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1486 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1485 new_command.extend(('--accept', 'theirs-conflict')) | 1487 new_command.extend(('--accept', 'theirs-conflict')) |
1486 elif options.manually_grab_svn_rev: | 1488 elif options.manually_grab_svn_rev: |
1487 new_command.append('--force') | 1489 new_command.append('--force') |
1488 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1490 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1489 new_command.extend(('--accept', 'postpone')) | 1491 new_command.extend(('--accept', 'postpone')) |
1490 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1492 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1491 new_command.extend(('--accept', 'postpone')) | 1493 new_command.extend(('--accept', 'postpone')) |
1492 return new_command | 1494 return new_command |
OLD | NEW |