rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
('running', self.root_dir + '/src/file/other'), | ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), | def testSyncJobs(self): if not self.enabled: return # TODO(maruel): safesync. self.gclient(['config', self.svn_base + 'trunk/src/']) # Test unversioned checkout. self.parseGclient( ['sync', '--deps', 'mac', '--jobs', '8'], ['running', 'running', # This is due to the way svn update is called for a # single file when Fil... |
('running', self.root_dir + '/src/file/other'), | ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), | def testInitialCheckoutNotYetDone(self): # Check that gclient can be executed when the initial checkout hasn't been # done yet. if not self.enabled: return self.gclient(['config', self.svn_base + 'trunk/src/']) self.parseGclient(['sync', '--jobs', '1'], ['running', 'running', # This is due to the way svn update is call... |
def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'): | def SendStack(last_tb, stack, url=None): if not url: url = DEFAULT_URL | def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'): print 'Sending crash report ...' try: params = { 'args': sys.argv, 'stack': stack, 'user': getpass.getuser(), } request = urllib.urlopen(url, urllib.urlencode(params)) print request.read() request.close() except IOError: print('There was a failure... |
last_tb = getattr(sys, 'last_traceback', None) if last_tb and sys.last_type is not KeyboardInterrupt: SendStack(''.join(traceback.format_tb(last_tb))) | last_value = getattr(sys, 'last_value', None) if last_value and not isinstance(last_value, KeyboardInterrupt): last_tb = getattr(sys, 'last_traceback', None) if last_tb: SendStack(repr(last_value), ''.join(traceback.format_tb(last_tb))) | def CheckForException(): last_tb = getattr(sys, 'last_traceback', None) if last_tb and sys.last_type is not KeyboardInterrupt: SendStack(''.join(traceback.format_tb(last_tb))) |
self._AttemptRebase('origin', files=files, verbose=options.verbose, printed_path=printed_path) | upstream_branch = 'origin' if options.revision: upstream_branch = revision self._AttemptRebase(upstream_branch, files=files, verbose=options.verbose, printed_path=printed_path) | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
[SVN.DiffItem(RelativePath(f, root, revision), full_move=full_move) | [SVN.DiffItem(RelativePath(f, root), full_move=full_move, revision=revision) | def RelativePath(path, root): """We must use relative paths.""" if path.startswith(root): return path[len(root):] return path |
'RunOnDeps', 'SaveConfig', 'SetConfig', 'SetDefaultConfig', 'supported_commands', 'PrintRevInfo', | 'PrintRevInfo', 'RunOnDeps', 'SaveConfig', 'SetConfig', 'SetDefaultConfig', 'deps_os_choices', 'supported_commands', | def testDir(self): members = [ 'ConfigContent', 'DEFAULT_CLIENT_FILE_TEXT', 'DEFAULT_SNAPSHOT_FILE_TEXT', 'DEFAULT_SNAPSHOT_SOLUTION_TEXT', 'DEPS_FILE', 'FileImpl', 'FromImpl', 'GetVar', 'LoadCurrentConfig', 'RunOnDeps', 'SaveConfig', 'SetConfig', 'SetDefaultConfig', 'supported_commands', 'PrintRevInfo', ] |
if isSVNDirty(): print "Working copy contains uncommitted files" | if (isSVNDirty() and not prompt("Working copy contains uncommitted files. Continue?")): | def drover(options, args): revision = options.revert or options.merge # Initialize some variables used below. They can be overwritten by # the drover.properties file. BASE_URL = "svn://svn.chromium.org/chrome" TRUNK_URL = BASE_URL + "/trunk/src" BRANCH_URL = BASE_URL + "/branches/$branch/src" SKIP_CHECK_WORKING = True... |
help="Only use specifics build slaves, ex: '--bot win' to " "run the try job only on the 'win' slave; see the try " | help="Only use specifics build slaves, ex: " "'--bot win,layout_mac'; see the try " | def TryChange(argv, file_list, swallow_exception, prog=None, extra_epilog=None): """ Args: argv: Arguments and options. file_list: Default value to pass to --file. swallow_exception: Whether we raise or swallow exceptions. """ # Parse argv parser = optparse.OptionParser(usage=USAGE, version=__version__, prog=prog) epil... |
"useful for gclient-style checkouts. Use @rev or " "@branch or @branch1..branch2 to specify the " "revision/branch to diff against.") | "useful for gclient-style checkouts. In git, checkout " "the branch with changes first. Use @rev or " "@branch to specify the " "revision/branch to diff against. If no @branch is " "given the diff will be against the upstream branch. " "If @branch then the diff is branch..HEAD. " "All edits must be checked in.") | def TryChange(argv, file_list, swallow_exception, prog=None, extra_epilog=None): """ Args: argv: Arguments and options. file_list: Default value to pass to --file. swallow_exception: Whether we raise or swallow exceptions. """ # Parse argv parser = optparse.OptionParser(usage=USAGE, version=__version__, prog=prog) epil... |
raise Error('failed to run command: %s' % ' '.join(args)) | raise CheckCallError(args, kwargs.get('cwd', None), rv, None) | def CheckCallAndFilter(args, stdout=None, filter_fn=None, print_stdout=None, call_filter_on_first_line=False, **kwargs): """Runs a command and calls back a filter function if needed. Accepts all subprocess.Popen() parameters plus: print_stdout: If True, the command's stdout is forwarded to stdout. filter_fn: A functio... |
def _GetAuthCookie(self, auth_token): | def _GetAuthCookie(self, host, auth_token): | def _GetAuthCookie(self, auth_token): """Fetches authentication cookies for an authentication token. |
req = self._CreateRequest("%s/_ah/login?%s" % (self.host, urllib.urlencode(args))) try: response = self.opener.open(req) except urllib2.HTTPError, e: response = e | tries = 0 url = "%s/_ah/login?%s" % (host, urllib.urlencode(args)) while tries < 3: req = self._CreateRequest(url) try: response = self.opener.open(req) except urllib2.HTTPError, e: response = e if e.code == 301: url = e.info()["location"] continue break | def _GetAuthCookie(self, auth_token): """Fetches authentication cookies for an authentication token. |
def _Authenticate(self): | def _Authenticate(self, host): | def _Authenticate(self): """Authenticates the user. |
self._GetAuthCookie(auth_token) | self._GetAuthCookie(host, auth_token) | def _Authenticate(self): """Authenticates the user. |
self._Authenticate() | self._Authenticate(self.host) | def Send(self, request_path, payload=None, content_type="application/octet-stream", timeout=None, extra_headers=None, **kwargs): """Sends an RPC and returns the response. |
args = dict(kwargs) url = "%s%s" % (self.host, request_path) if args: url += "?" + urllib.urlencode(args) | def Send(self, request_path, payload=None, content_type="application/octet-stream", timeout=None, extra_headers=None, **kwargs): """Sends an RPC and returns the response. | |
self._Authenticate() | url_loc = urlparse.urlparse(url) self._Authenticate('%s://%s' % (url_loc[0], url_loc[1])) | def Send(self, request_path, payload=None, content_type="application/octet-stream", timeout=None, extra_headers=None, **kwargs): """Sends an RPC and returns the response. |
def _Authenticate(self): | def _Authenticate(self, *args): | def _Authenticate(self): """Save the cookie jar after authentication.""" super(HttpRpcServer, self)._Authenticate() if self.save_cookies: StatusUpdate("Saving authentication cookies to %s" % self.cookie_file) self.cookie_jar.save() |
super(HttpRpcServer, self)._Authenticate() | super(HttpRpcServer, self)._Authenticate(*args) | def _Authenticate(self): """Save the cookie jar after authentication.""" super(HttpRpcServer, self)._Authenticate() if self.save_cookies: StatusUpdate("Saving authentication cookies to %s" % self.cookie_file) self.cookie_jar.save() |
"and verify you are a human. Then try again.") | "and verify you are a human. Then try again.\n" "If you are using a Google Apps account the URL is:\n" "https://www.google.com/a/yourdomain.com/UnlockCaptcha") | def _Authenticate(self): """Authenticates the user. |
default="codereview.appspot.com", | default=DEFAULT_REVIEW_SERVER, | def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects. |
password = getpass.getpass("Password for %s: " % local_email) | password = None if keyring: password = keyring.get_password(host, local_email) if password is not None: print "Using password from system keyring." else: password = getpass.getpass("Password for %s: " % local_email) if keyring: answer = raw_input("Store password in system keyring?(y/N) ").strip() if answer == "y": keyr... | def GetUserCredentials(): """Prompts the user for a username and password.""" # Create a local alias to the email variable to avoid Python's crazy # scoping rules. local_email = email if local_email is None: local_email = GetEmail("Email (login for uploading to %s)" % server) password = getpass.getpass("Password for %s... |
custom_vars, deps_file): | custom_vars, deps_file, should_process): | def __init__(self, parent, name, url, safesync_url, custom_deps, custom_vars, deps_file): GClientKeywords.__init__(self) self.parent = parent self.name = name self.url = url self.parsed_url = None # These 2 are only set in .gclient and not in DEPS files. self.safesync_url = safesync_url self.custom_vars = custom_vars o... |
self.direct_reference = False | self.should_process = should_process | def __init__(self, parent, name, url, safesync_url, custom_deps, custom_vars, deps_file): GClientKeywords.__init__(self) self.parent = parent self.name = name self.url = url self.parsed_url = None # These 2 are only set in .gclient and not in DEPS files. self.safesync_url = safesync_url self.custom_vars = custom_vars o... |
ref.ParseDepsFile(False) | ref.ParseDepsFile() | def LateOverride(self, url): """Resolves the parsed url from url. |
def ParseDepsFile(self, direct_reference): | def ParseDepsFile(self): | def ParseDepsFile(self, direct_reference): """Parses the DEPS file for this dependency.""" if direct_reference: # Maybe it was referenced earlier by a From() keyword but it's now # directly referenced. self.direct_reference = direct_reference if self.deps_parsed: logging.debug('%s was already parsed' % self.name) retur... |
if direct_reference: self.direct_reference = direct_reference | assert self.processed == True | def ParseDepsFile(self, direct_reference): """Parses the DEPS file for this dependency.""" if direct_reference: # Maybe it was referenced earlier by a From() keyword but it's now # directly referenced. self.direct_reference = direct_reference if self.deps_parsed: logging.debug('%s was already parsed' % self.name) retur... |
None)) | None, should_process)) | def ParseDepsFile(self, direct_reference): """Parses the DEPS file for this dependency.""" if direct_reference: # Maybe it was referenced earlier by a From() keyword but it's now # directly referenced. self.direct_reference = direct_reference if self.deps_parsed: logging.debug('%s was already parsed' % self.name) retur... |
if self.recursion_limit(): | if self.recursion_limit() > 0: | def run(self, options, revision_overrides, command, args, work_queue): """Runs 'command' before parsing the DEPS in case it's a initial checkout or a revert.""" assert self._file_list == [] # When running runhooks, there's no need to consult the SCM. # All known hooks are expected to run unconditionally regardless of w... |
self.ParseDepsFile(True) | self.ParseDepsFile() | def run(self, options, revision_overrides, command, args, work_queue): """Runs 'command' before parsing the DEPS in case it's a initial checkout or a revert.""" assert self._file_list == [] # When running runhooks, there's no need to consult the SCM. # All known hooks are expected to run unconditionally regardless of w... |
if self.deps_hooks and self.direct_reference: | if self.deps_hooks: | def RunHooksRecursively(self, options): """Evaluates all hooks, running actions as needed. run() must have been called before to load the DEPS.""" # If "--force" was specified, run all hooks regardless of what files have # changed. if self.deps_hooks and self.direct_reference: # TODO(maruel): If the user is using git o... |
if self.recursion_limit(): for s in self.dependencies: s.RunHooksRecursively(options) | for s in self.dependencies: s.RunHooksRecursively(options) | def RunHooksRecursively(self, options): """Evaluates all hooks, running actions as needed. run() must have been called before to load the DEPS.""" # If "--force" was specified, run all hooks regardless of what files have # changed. if self.deps_hooks and self.direct_reference: # TODO(maruel): If the user is using git o... |
if self.direct_reference or include_all: for d in self.dependencies: | for d in self.dependencies: if d.should_process or include_all: | def subtree(self, include_all): result = [] # Add breadth-first. if self.direct_reference or include_all: for d in self.dependencies: result.append(d) for d in self.dependencies: result.extend(d.subtree(include_all)) return result |
'custom_vars', 'deps_hooks', '_file_list', 'processed', 'hooks_ran', 'deps_parsed', 'requirements', 'direct_reference'): | 'custom_vars', 'deps_hooks', '_file_list', 'should_process', 'processed', 'hooks_ran', 'deps_parsed', 'requirements'): | def __str__(self): out = [] for i in ('name', 'url', 'parsed_url', 'safesync_url', 'custom_deps', 'custom_vars', 'deps_hooks', '_file_list', 'processed', 'hooks_ran', 'deps_parsed', 'requirements', 'direct_reference'): # 'deps_file' if self.__dict__[i]: out.append('%s: %s' % (i, self.__dict__[i])) |
Dependency.__init__(self, None, None, None, None, None, None, None) | Dependency.__init__(self, None, None, None, None, None, None, None, True) | def __init__(self, root_dir, options): # Do not change previous behavior. Only solution level and immediate DEPS # are processed. self._recursion_limit = 2 Dependency.__init__(self, None, None, None, None, None, None, None) self._options = options if options.deps_os: enforced_os = options.deps_os.split(',') else: enfor... |
None)) | None, True)) | def SetConfig(self, content): assert self.dependencies == [] config_dict = {} self.config_content = content try: exec(content, config_dict) except SyntaxError, e: gclient_utils.SyntaxErrorToError('.gclient', e) for s in config_dict.get('solutions', []): try: self.dependencies.append(Dependency( self, s['name'], s['url'... |
def ParseDepsFile(self, direct_reference): | def ParseDepsFile(self): | def ParseDepsFile(self, direct_reference): """No DEPS to parse for a .gclient file.""" raise gclient_utils.Error('Internal error') |
if 'CHROME_HEADLESS' not in os.environ: jobs = 8 else: jobs = 1 parser.add_option('-j', '--jobs', default=jobs, type='int', | parser.add_option('-j', '--jobs', default=1, type='int', | def Main(argv): """Doesn't parse the arguments here, just find the right subcommand to execute.""" try: # Do it late so all commands are listed. CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) for fn in dir(sys.modules[__name__]) if fn.startsw... |
self._long_text) | self._long_text.encode('ascii', 'replace')) | def _Handle(self, output_stream, input_stream, may_prompt=True): """Writes this result to the output stream. |
if options.dry_run: return | def _SendChangeHTTP(options): """Send a change to the try server using the HTTP protocol.""" if not options.host: raise NoTryServerAccess('Please use the --host option to specify the try ' 'server host to connect to.') if not options.port: raise NoTryServerAccess('Please use the --port option to specify the try ' 'serv... | |
url, revision = gclient_utils.SplitUrlRevision(self.url) | url, deps_revision = gclient_utils.SplitUrlRevision(self.url) | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
if options.revision: | if options.revision or deps_revision: | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
description = gcl.GetIssueDescription(issue) | description = Backquote(['git', 'cl', 'status', '--field=desc']) | def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None |
merge_base = self._Run(['merge-base', 'HEAD', 'origin']) self._Run(['diff', merge_base], redirect_stdout=False) | merge_base = self._Capture(['merge-base', 'HEAD', 'origin']) self._Run(['diff', merge_base]) | def diff(self, options, args, file_list): merge_base = self._Run(['merge-base', 'HEAD', 'origin']) self._Run(['diff', merge_base], redirect_stdout=False) |
self._Run(['checkout-index', '-a', '--prefix=%s/' % export_path], redirect_stdout=False) | self._Run(['checkout-index', '-a', '--prefix=%s/' % export_path]) | def export(self, options, args, file_list): """Export a clean directory tree into the given path. |
merge_base = self._Run(['merge-base', 'HEAD', 'origin']) | merge_base = self._Capture(['merge-base', 'HEAD', 'origin']) | def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the repository. |
files = self._Run(['ls-files']).split() | files = self._Capture(['ls-files']).split() | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
self._Run(['reset', '--hard', 'HEAD'], redirect_stdout=False) | self._Run(['reset', '--hard', 'HEAD']) | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
self._Run(['checkout', '--quiet', '%s^0' % revision]) | self._Capture(['checkout', '--quiet', '%s^0' % revision]) | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
files = self._Run(['diff', upstream_branch, '--name-only']).split() | files = self._Capture(['diff', upstream_branch, '--name-only']).split() | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
files = self._Run(['diff', deps_revision, '--name-only']).split() self._Run(['reset', '--hard', deps_revision], redirect_stdout=False) | files = self._Capture(['diff', deps_revision, '--name-only']).split() self._Run(['reset', '--hard', deps_revision]) | def revert(self, options, args, file_list): """Reverts local modifications. |
return self._Run(['rev-parse', 'HEAD']) | return self._Capture(['rev-parse', 'HEAD']) | def revinfo(self, options, args, file_list): """Display revision""" return self._Run(['rev-parse', 'HEAD']) |
merge_base = self._Run(['merge-base', 'HEAD', 'origin']) self._Run(['diff', '--name-status', merge_base], redirect_stdout=False) files = self._Run(['diff', '--name-only', merge_base]).split() | merge_base = self._Capture(['merge-base', 'HEAD', 'origin']) self._Run(['diff', '--name-status', merge_base]) files = self._Capture(['diff', '--name-only', merge_base]).split() | def status(self, options, args, file_list): """Display status information.""" if not os.path.isdir(self.checkout_path): options.stdout.write( ('\n________ couldn\'t run status in %s:\nThe directory ' 'does not exist.\n') % self.checkout_path) else: merge_base = self._Run(['merge-base', 'HEAD', 'origin']) self._Run(['di... |
self._Run(clone_cmd, cwd=self._root_dir, redirect_stdout=False) | self._Run(clone_cmd, cwd=self._root_dir) | def _Clone(self, revision, url, options): """Clone a git repository from the given URL. |
self._Run(['checkout', '--quiet', '%s^0' % revision]) | self._Capture(['checkout', '--quiet', '%s^0' % revision]) | def _Clone(self, revision, url, options): """Clone a git repository from the given URL. |
files.extend(self._Run(['diff', upstream, '--name-only']).split()) | files.extend(self._Capture(['diff', upstream, '--name-only']).split()) | def _AttemptRebase(self, upstream, files, options, newbase=None, branch=None, printed_path=False): """Attempt to rebase onto either upstream or, if specified, newbase.""" files.extend(self._Run(['diff', upstream, '--name-only']).split()) revision = upstream if newbase: revision = newbase if not printed_path: options.st... |
self._Run(['reset', '--hard', 'HEAD'], redirect_stdout=False) | self._Run(['reset', '--hard', 'HEAD']) | def _AttemptRebase(self, upstream, files, options, newbase=None, branch=None, printed_path=False): """Attempt to rebase onto either upstream or, if specified, newbase.""" files.extend(self._Run(['diff', upstream, '--name-only']).split()) revision = upstream if newbase: revision = newbase if not printed_path: options.st... |
name = "saved-by-gclient-" + self._Run(["rev-parse", "--short", "HEAD"]) self._Run(["branch", name]) | name = ('saved-by-gclient-' + self._Capture(['rev-parse', '--short', 'HEAD'])) self._Capture(['branch', name]) | def _CheckDetachedHead(self, rev_str, options): # HEAD is detached. Make sure it is safe to move away from (i.e., it is # reference by a commit). If not, error out -- most likely a rebase is # in progress, try to detect so we can give a better error. try: _, _ = scm.GIT.Capture( ['name-rev', '--no-undefined', 'HEAD'], ... |
branch = self._Run(['rev-parse', '--abbrev-ref=strict', 'HEAD']) | branch = self._Capture(['rev-parse', '--abbrev-ref=strict', 'HEAD']) | def _GetCurrentBranch(self): # Returns name of current branch or None for detached HEAD branch = self._Run(['rev-parse', '--abbrev-ref=strict', 'HEAD']) if branch == 'HEAD': return None return branch |
def _Run(self, args, cwd=None, redirect_stdout=True): if cwd is None: cwd = self.checkout_path stdout = None if redirect_stdout: stdout = subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = ['git'] + args logging.debug(cmd) | def _Capture(self, args): return gclient_utils.CheckCall(['git'] + args, cwd=self.checkout_path)[0].strip() def _Run(self, args, **kwargs): kwargs.setdefault('cwd', self.checkout_path) | def _Run(self, args, cwd=None, redirect_stdout=True): # TODO(maruel): Merge with Capture or better gclient_utils.CheckCall(). if cwd is None: cwd = self.checkout_path stdout = None if redirect_stdout: stdout = subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = ['git'] + args logging.debug(cmd) try: sp = gcl... |
sp = gclient_utils.Popen(cmd, cwd=cwd, stdout=stdout) output = sp.communicate()[0] | gclient_utils.Popen(['git'] + args, **kwargs).communicate() | def _Run(self, args, cwd=None, redirect_stdout=True): # TODO(maruel): Merge with Capture or better gclient_utils.CheckCall(). if cwd is None: cwd = self.checkout_path stdout = None if redirect_stdout: stdout = subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = ['git'] + args logging.debug(cmd) try: sp = gcl... |
if sp.returncode: raise gclient_utils.Error('git command %s returned %d' % (args[0], sp.returncode)) if output is not None: return output.strip() | def _Run(self, args, cwd=None, redirect_stdout=True): # TODO(maruel): Merge with Capture or better gclient_utils.CheckCall(). if cwd is None: cwd = self.checkout_path stdout = None if redirect_stdout: stdout = subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = ['git'] + args logging.debug(cmd) try: sp = gcl... | |
'random', 're', 'shutil', 'string', 'subprocess', 'sys', 'tempfile', | 'random', 're', 'string', 'subprocess', 'sys', 'tempfile', | def testMembersChanged(self): self.mox.ReplayAll() members = [ 'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE', 'CMDchange', 'CMDchanges', 'CMDcommit', 'CMDdelete', 'CMDdeleteempties', 'CMDdescription', 'CMDdiff', 'CMDhelp', 'CMDlint', 'CMDnothave', 'CMDopened', 'CMDpassthru', 'CMDpresubmit', 'CMDrename', 'CMDsetting... |
files = GetFilesNotInCL() | files = [f[1] for f in GetFilesNotInCL()] | def CMDdiff(args): """Diffs all files in the changelist or all files that aren't in a CL.""" files = None if args: change_info = ChangeInfo.Load(args.pop(0), GetRepositoryRoot(), True, True) files = change_info.GetFileNames() else: files = GetFilesNotInCL() root = GetRepositoryRoot() cmd = ['svn', 'diff'] cmd.extend([... |
group.add_option("--webkit", action="append_const", const="third_party/WebKit", dest="PATH", help="Shorthand for -s third_party/WebKit") | def WebKitRevision(options, opt, value, parser): if parser.rargs and not parser.rargs[0].startswith('-'): options.sub_rep.append('third_party/WebKit@%s' % parser.rargs.pop(0)) else: options.sub_rep.append('third_party/WebKit') group.add_option("-W", "--webkit", action="callback", callback=WebKitRevision, metavar="BRAN... | def TryChange(argv, file_list, swallow_exception, prog=None): """ Args: argv: Arguments and options. file_list: Default value to pass to --file. swallow_exception: Whether we raise or swallow exceptions. """ # Parse argv parser = optparse.OptionParser(usage=USAGE, version=__version__, prog=prog) parser.add_option("-v",... |
if not self._options.delete_unversioned_trees or modified_files: | if (not self._options.delete_unversioned_trees or (modified_files and not self._options.force)): | def RunOnDeps(self, command, args): """Runs a command on each dependency in a client and its dependencies. |
help='delete any unexpected unversioned trees ' 'that are in the checkout') | help='delete any dependency that have been removed from ' 'last sync as long as there is no local modification. ' 'Coupled with --force, it will remove them even with ' 'local modifications') | def CMDsync(parser, args): """Checkout/update all modules.""" parser.add_option('-f', '--force', action='store_true', help='force update even for unchanged modules') parser.add_option('-n', '--nohooks', action='store_true', help='don\'t run hooks after the update is complete') parser.add_option('-r', '--revision', acti... |
entries = {} entries_deps_content = {} | def GetURLAndRev(name, original_url): url, revision = gclient_utils.SplitUrlRevision(original_url) if not revision: if revision_overrides.has_key(name): return (url, revision_overrides[name]) else: scm = gclient_scm.CreateSCM(solution["url"], self._root_dir, name) return (url, scm.revinfo(self._options, [], None)) else... | |
parser.add_option('-j', '--jobs', default=1, type='int', help='Specify how many SCM commands can run in parallel') | parser.add_option('-j', '--jobs', default=8, type='int', help='Specify how many SCM commands can run in parallel; ' 'default=%default') | def Main(argv): """Doesn't parse the arguments here, just find the right subcommand to execute.""" try: # Do it late so all commands are listed. CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) for fn in dir(sys.modules[__name__]) if fn.startsw... |
return gclient_util.FileRead(filepath) | return gclient_utils.FileRead(filepath) | def ReadRootFile(self, filename): if not self.options.root: filepath = os.path.join(self.checkout_root, filename) if os.path.isfile(filepath): logging.info('Found %s at %s' % (filename, self.checkout_root)) return gclient_util.FileRead(filepath) return None cur = os.path.abspath(self.checkout_root) if self.gclient_root... |
if current_type == "branch": remote_output, remote_err = scm.GIT.Capture( ['fetch'] + verbose + ['origin', revision], self.checkout_path, print_error=False) else: remote_output, remote_err = scm.GIT.Capture( | remote_output, remote_err = scm.GIT.Capture( | def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. |
x.startswith('svn: Unknown hostname')): | x.startswith('svn: Unknown hostname') or x.startswith('svn: Server sent unexpected return value')): | def IsKnownFailure(): for x in failure: if (x.startswith('svn: OPTIONS of') or x.startswith('svn: PROPFIND of') or x.startswith('svn: REPORT of') or x.startswith('svn: Unknown hostname')): return True return False |
sub_target = url.sub_target_name or url | sub_target = url.sub_target_name or self.name | def LateOverride(self, url): overriden_url = self.get_custom_deps(self.name, url) if overriden_url != url: self.parsed_url = overriden_url logging.debug('%s, %s was overriden to %s' % (self.name, url, self.parsed_url)) elif isinstance(url, self.FromImpl): ref = [dep for dep in self.tree(True) if url.module_name == dep.... |
self.direct_reference = direct_reference | self.direct_reference = True | def ParseDepsFile(self, direct_reference): """No DEPS to parse for a .gclient file.""" self.direct_reference = direct_reference self.deps_parsed = True |
issue = BackquoteAsInteger(['git', 'cl', 'status', '--field=id']) patchset = BackquoteAsInteger(['git', 'cl', 'status', '--field=patch']) | cl = git_cl.Changelist() issue = cl.GetIssue() patchset = cl.GetPatchset() | def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None |
description = Backquote(['git', 'cl', 'status', '--field=desc']) | description = cl.GetDescription() | def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None |
gcl_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gcl") | gcl_path = os.path.join(depot_tools_dir_, "gcl") | def runGcl(subcommand): gcl_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gcl") if not os.path.exists(gcl_path): print "WARNING: gcl not found beside drover.py. Using system gcl instead..." gcl_path = 'gcl' command = "%s %s" % (gcl_path, subcommand) return os.system(command) |
data = gcl.GetCachedFile(filename, use_root=True) | data = gcl.GetCachedFile(filename) | def ReadRootFile(self, filename): try: # Try to search on the subversion repository for the file. import gcl data = gcl.GetCachedFile(filename, use_root=True) logging.debug('%s:\n%s' % (filename, data)) return data except ImportError: try: data = gclient_utils.FileRead(os.path.join(self.checkout_root, filename)) loggin... |
if command == 'update' and not self._options.verbose: | if command in ('update', 'revert') and sys.stdout.isatty(): | def RunOnDeps(self, command, args): """Runs a command on each dependency in a client and its dependencies. |
self._Authenticate() | url_loc = urlparse.urlparse(url) self._Authenticate('%s://%s' % (url_loc.scheme, url_loc.netloc)) | def Send(self, request_path, payload=None, content_type="application/octet-stream", timeout=None, extra_headers=None, **kwargs): """Sends an RPC and returns the response. |
data = SVN.Capture(command, None) if data: pass elif SVN.IsMoved(filename): | if SVN.IsMoved(filename): | def DiffItem(filename, full_move=False, revision=None): """Diffs a single file. |
data = "Index: %s\n" % filename | data = SVN.Capture(command, None) if not data: data = "Index: %s\n" % filename | def DiffItem(filename, full_move=False, revision=None): """Diffs a single file. |
pass | data = SVN.Capture(command, None) | def DiffItem(filename, full_move=False, revision=None): """Diffs a single file. |
ErrorExit(msg, exit=False) def ErrorExit(msg, do_exit=True): """Print an error message to stderr and optionally exit.""" | def Warn(msg): ErrorExit(msg, exit=False) | |
if do_exit: sys.exit(1) | def ErrorExit(msg): print >> sys.stderr, msg sys.exit(1) | def ErrorExit(msg, do_exit=True): """Print an error message to stderr and optionally exit.""" print >> sys.stderr, msg if do_exit: sys.exit(1) |
path = os.path.join(self._root_dir, self.relpath) | def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the repository. | |
command = ['git', 'diff', merge_base] filterer = DiffFilterer(self.relpath) | def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the repository. | |
command, cwd=path, filter_fn=filterer.Filter, stdout=options.stdout) | ['git', 'diff', merge_base], cwd=self.checkout_path, filter_fn=DiffFilterer(self.relpath, options.stdout).Filter, stdout=options.stdout) | def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the repository. |
path = os.path.join(self._root_dir, self.relpath) if not os.path.isdir(path): | if not os.path.isdir(self.checkout_path): | def revert(self, options, args, file_list): """Reverts local modifications. |
path = os.path.join(self._root_dir, self.relpath) if not os.path.isdir(path): raise gclient_utils.Error('Directory %s is not present.' % path) | if not os.path.isdir(self.checkout_path): raise gclient_utils.Error('Directory %s is not present.' % self.checkout_path) | def diff(self, options, args, file_list): # NOTE: This function does not currently modify file_list. path = os.path.join(self._root_dir, self.relpath) if not os.path.isdir(path): raise gclient_utils.Error('Directory %s is not present.' % path) self._Run(['diff'] + args, options) |
path = os.path.join(self._root_dir, self.relpath) if not os.path.isdir(path): raise gclient_utils.Error('Directory %s is not present.' % path) command = ['svn', 'diff', '-x', '--ignore-eol-style'] command.extend(args) filterer = DiffFilterer(self.relpath, options.stdout) gclient_utils.CheckCallAndFilter(command, cwd=p... | if not os.path.isdir(self.checkout_path): raise gclient_utils.Error('Directory %s is not present.' % self.checkout_path) gclient_utils.CheckCallAndFilter( ['svn', 'diff', '-x', '--ignore-eol-style'] + args, cwd=self.checkout_path, print_stdout=False, filter_fn=DiffFilterer(self.relpath, options.stdout).Filter, | def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the repository.""" path = os.path.join(self._root_dir, self.relpath) if not os.path.isdir(path): raise gclient_utils.Error('Directory %s is not present.' % path) command = ['svn', 'diff', '-x', '--ignore-eol-style'] ... |
checkout_path = os.path.join(self._root_dir, self.relpath) git_path = os.path.join(self._root_dir, self.relpath, '.git') | git_path = os.path.join(self.checkout_path, '.git') | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
if not os.path.exists(checkout_path): | if not os.path.exists(self.checkout_path): | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
command = ['checkout', url, checkout_path] | command = ['checkout', url, self.checkout_path] | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
from_info = scm.SVN.CaptureInfo(os.path.join(checkout_path, '.'), '.') | from_info = scm.SVN.CaptureInfo(os.path.join(self.checkout_path, '.'), '.') | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
checkout_path) | self.checkout_path) | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
dir_info = scm.SVN.CaptureStatus(os.path.join(checkout_path, '.')) if [True for d in dir_info if d[0][2] == 'L' and d[1] == checkout_path]: | dir_info = scm.SVN.CaptureStatus(os.path.join(self.checkout_path, '.')) if [True for d in dir_info if d[0][2] == 'L' and d[1] == self.checkout_path]: | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
for status in scm.SVN.CaptureStatus(checkout_path): | for status in scm.SVN.CaptureStatus(self.checkout_path): | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
'try again.') % (url, checkout_path)) | 'try again.') % (url, self.checkout_path)) | def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.