bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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",...
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",...
458,000
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",...
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",...
458,001
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",...
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",...
458,002
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",...
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",...
458,003
def _ParseSendChangeOptions(options): """Parse common options passed to _SendChangeHTTP and _SendChangeSVN.""" values = {} if options.email: values['email'] = options.email values['user'] = options.user values['name'] = options.name if options.bot: values['bot'] = ','.join(options.bot) if options.revision: values['revi...
def _ParseSendChangeOptions(options): """Parse common options passed to _SendChangeHTTP and _SendChangeSVN.""" values = {} if options.email: values['email'] = options.email values['user'] = options.user values['name'] = options.name if options.bot: values['bot'] = ','.join(options.bot) if options.revision: values['revi...
458,004
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",...
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",...
458,005
def _GetAuthToken(self, email, password): """Uses ClientLogin to authenticate the user, returning an auth token.
def _GetAuthToken(self, host, email, password): """Uses ClientLogin to authenticate the user, returning an auth token.
458,006
def _GetAuthToken(self, email, password): """Uses ClientLogin to authenticate the user, returning an auth token.
def _GetAuthToken(self, email, password): """Uses ClientLogin to authenticate the user, returning an auth token.
458,007
def _Authenticate(self, host): """Authenticates the user.
def _Authenticate(self, host): """Authenticates the user.
458,008
def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): """Retrieves a file from the repository and caches it in GetCacheDir() for max_age seconds. use_root: If False, look up the arborescence for the first match, otherwise go directory to the root repository. Note: The cache will be inconsistent if the same...
def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): """Retrieves a file from the repository and caches it in GetCacheDir() for max_age seconds. use_root: If False, look up the arborescence for the first match, otherwise go directory to the root repository. Note: The cache will be inconsistent if the same...
458,009
def BackquoteAsInteger(cmd, cwd=None): """Like Backquote, but returns either an int or None.""" try: return int(Backquote(cmd, cwd)) except ValueError: return None
def ConvertToInteger(input): """Convert a string to integer, but returns either an int or None.""" try: return int(Backquote(cmd, cwd)) except ValueError: return None
458,010
def BackquoteAsInteger(cmd, cwd=None): """Like Backquote, but returns either an int or None.""" try: return int(Backquote(cmd, cwd)) except ValueError: return None
def BackquoteAsInteger(cmd, cwd=None): """Like Backquote, but returns either an int or None.""" try: return int(input) except TypeError, ValueError: return None
458,011
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
458,012
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
458,013
def main(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 P...
def main(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 P...
458,014
def main(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 P...
def main(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 P...
458,015
def main(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 P...
def main(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 P...
458,016
def main(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 P...
def main(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 P...
458,017
def commit_git(repo): """Commits the changes and returns the new hash.""" check_call(['git', 'add', '-A', '-f'], cwd=repo) check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo) rev = Popen(['git', 'show-ref', '--head', 'HEAD'], cwd=repo).communicate()[0].split(' ', 1)[0] logging.debug('At revision %s' % rev...
def commit_git(repo): """Commits the changes and returns the new hash.""" check_call(['git', 'add', '-A', '-f'], cwd=repo) check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo) rev = Popen(['git', 'show-ref', '--head', 'HEAD'], cwd=repo).communicate()[0].split(' ', 1)[0] logging.debug('At revision %s' % rev...
458,018
def commit_git(repo): """Commits the changes and returns the new hash.""" check_call(['git', 'add', '-A', '-f'], cwd=repo) check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo) rev = Popen(['git', 'show-ref', '--head', 'HEAD'], cwd=repo).communicate()[0].split(' ', 1)[0] logging.debug('At revision %s' % rev...
def commit_git(repo): """Commits the changes and returns the new hash.""" check_call(['git', 'add', '-A', '-f'], cwd=repo) check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo) rev = Popen(['git', 'show-ref', '--head', 'HEAD'], cwd=repo).communicate()[0].split(' ', 1)[0] logging.debug('At revision %s' % rev...
458,019
def setUpGIT(self): """Creates git repositories and start the servers.""" if self.gitdaemon: return True self.setUp() if sys.platform == 'win32': return False for repo in ['repo_%d' % r for r in range(1, 5)]: check_call(['git', 'init', '-q', join(self.git_root, repo)]) self.git_hashes[repo] = [None]
def setUpGIT(self): """Creates git repositories and start the servers.""" if self.gitdaemon: return True self.setUp() if sys.platform == 'win32': return False for repo in ['repo_%d' % r for r in range(1, 5)]: check_call(['git', 'init', '-q', join(self.git_root, repo)]) self.git_hashes[repo] = [None]
458,020
def setUpGIT(self): """Creates git repositories and start the servers.""" if self.gitdaemon: return True self.setUp() if sys.platform == 'win32': return False for repo in ['repo_%d' % r for r in range(1, 5)]: check_call(['git', 'init', '-q', join(self.git_root, repo)]) self.git_hashes[repo] = [None]
def setUpGIT(self): """Creates git repositories and start the servers.""" if self.gitdaemon: return True self.setUp() if sys.platform == 'win32': return False for repo in ['repo_%d' % r for r in range(1, 5)]: check_call(['git', 'init', '-q', join(self.git_root, repo)]) self.git_hashes[repo] = [None]
458,021
def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) if not FakeReposTestBase.FAKE_REPOS: FakeReposTestBase.FAKE_REPOS = FakeRepos()
def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) if not FakeReposTestBase.FAKE_REPOS: FakeReposTestBase.FAKE_REPOS = FakeRepos()
458,022
def CMDcommit(change_list, args): """Commits the changelist to the repository.""" if not change_info.GetFiles(): print "Nothing to commit, changelist is empty." return 1 if not OptionallyDoPresubmitChecks(change_info, True, args): return 1 # We face a problem with svn here: Let's say change 'bleh' modifies # svn:ignor...
def CMDcommit(change_info, args): """Commits the changelist to the repository.""" if not change_info.GetFiles(): print "Nothing to commit, changelist is empty." return 1 if not OptionallyDoPresubmitChecks(change_info, True, args): return 1 # We face a problem with svn here: Let's say change 'bleh' modifies # svn:ignor...
458,023
def Main(argv): """Parse command line arguments and dispatch command.""" option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, version=__version__) option_parser.disable_interspersed_args() option_parser.add_option("", "--force", action="store_true", default=False, help=("(update/sync only) force update even...
def Main(argv): """Parse command line arguments and dispatch command.""" option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, version=__version__) option_parser.disable_interspersed_args() option_parser.add_option("", "--force", action="store_true", default=False, help=("(update/sync only) force update even...
458,024
def Main(argv): """Parse command line arguments and dispatch command.""" option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, version=__version__) option_parser.disable_interspersed_args() option_parser.add_option("", "--force", action="store_true", default=False, help=("(update/sync only) force update even...
def Main(argv): """Parse command line arguments and dispatch command.""" option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT, version=__version__) option_parser.disable_interspersed_args() option_parser.add_option("", "--force", action="store_true", default=False, help=("(update/sync only) force update even...
458,025
def GenerateDiff(cwd, branch=None, branch_head='HEAD', full_move=False, files=None): """Diffs against the upstream branch or optionally another branch.
def GenerateDiff(cwd, branch=None, branch_head='HEAD', full_move=False, files=None): """Diffs against the upstream branch or optionally another branch.
458,026
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
def Popen(args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs['...
458,027
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ logging.debug(u'%s, cwd=%s' % (u' '.join(args), kwargs.get('cwd', ''))) if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easie...
458,028
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: # It's easier to parse the stdout if it is always in English. kwargs['env'] = os.environ.copy() kwargs['en...
458,029
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
458,030
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
def Popen(*args, **kwargs): """Calls subprocess.Popen() with hacks to work around certain behaviors. Ensure English outpout for svn and make it work reliably on Windows. """ copied = False if not 'env' in kwargs: copied = True kwargs = kwargs.copy() # It's easier to parse the stdout if it is always in English. kwargs[...
458,031
def CheckCall(command, cwd=None, print_error=True): """Similar subprocess.check_call() but redirects stdout and returns (stdout, stderr). Works on python 2.4 """ logging.debug('%s, cwd=%s' % (str(command), str(cwd))) try: stderr = None if not print_error: stderr = subprocess.PIPE process = Popen(command, cwd=cwd, stdo...
def CheckCall(command, cwd=None, print_error=True): """Similar subprocess.check_call() but redirects stdout and returns (stdout, stderr). Works on python 2.4 """ try: stderr = None if not print_error: stderr = subprocess.PIPE process = Popen(command, cwd=cwd, stdout=subprocess.PIPE, stderr=stderr) std_out, std_err = p...
458,032
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 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...
458,033
def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects.
def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects.
458,034
def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects.
def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects.
458,035
def GetRpcServer(server, email=None, host_override=None, save_cookies=True, account_type=AUTH_ACCOUNT_TYPE): """Returns an instance of an AbstractRpcServer. Args: server: String containing the review server URL. email: String containing user's email address. host_override: If not None, string containing an alternate h...
def GetRpcServer(server, email=None, host_override=None, save_cookies=True, account_type=AUTH_ACCOUNT_TYPE): """Returns an instance of an AbstractRpcServer. Args: server: String containing the review server URL. email: String containing user's email address. host_override: If not None, string containing an alternate h...
458,036
def _GuessBase(self, required): """Returns the SVN base URL.
def _GuessBase(self, required): """Returns the SVN base URL.
458,037
def _GuessBase(self, required): """Returns the SVN base URL.
def _GuessBase(self, required): """Returns the SVN base URL.
458,038
def _GuessBase(self, required): """Returns the SVN base URL.
def _GuessBase(self, required): """Returns the SVN base URL.
458,039
def _GuessBase(self, required): """Returns the SVN base URL.
def _GuessBase(self, required): """Returns the SVN base URL.
458,040
def GenerateDiff(self, extra_args): extra_args = extra_args[:] if self.options.revision: extra_args = [self.options.revision] + extra_args
def GenerateDiff(self, extra_args): extra_args = extra_args[:] if self.options.revision: extra_args = [self.options.revision] + extra_args
458,041
def GenerateDiff(self, extra_args): # If no file specified, restrict to the current subdir extra_args = extra_args or ["."] cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args data = RunShell(cmd, silent_ok=True) svndiff = [] filecount = 0 for line in data.splitlines(): m = re.match("diff --git a/(\S+) b/(\...
def GenerateDiff(self, extra_args): # If no file specified, restrict to the current subdircmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args data = RunShell(cmd, silent_ok=True) svndiff = [] filecount = 0 for line in data.splitlines(): m = re.match("diff --git a/(\S+) b/(\S+)", line) if m: # Modify line to...
458,042
def GetBaseFile(self, filename): # "hg status" and "hg cat" both take a path relative to the current subdir # rather than to the repo root, but "hg diff" has given us the full path # to the repo root. base_content = "" new_content = None is_binary = False oldrelpath = relpath = self._GetRelPath(filename) # "hg status -...
def GetBaseFile(self, filename): # "hg status" and "hg cat" both take a path relative to the current subdir # rather than to the repo root, but "hg diff" has given us the full path # to the repo root. base_content = "" new_content = None is_binary = False oldrelpath = relpath = self._GetRelPath(filename) # "hg status -...
458,043
def GetBaseFile(self, filename): # "hg status" and "hg cat" both take a path relative to the current subdir # rather than to the repo root, but "hg diff" has given us the full path # to the repo root. base_content = "" new_content = None is_binary = False oldrelpath = relpath = self._GetRelPath(filename) # "hg status -...
def GetBaseFile(self, filename): # "hg status" and "hg cat" both take a path relative to the current subdir # rather than to the repo root, but "hg diff" has given us the full path # to the repo root. base_content = "" new_content = None is_binary = False oldrelpath = relpath = self._GetRelPath(filename) # "hg status -...
458,044
def LoadSubversionAutoProperties(): """Returns the content of [auto-props] section of Subversion's config file as a dictionary. Returns: A dictionary whose key-value pair corresponds the [auto-props] section's key-value pair. In following cases, returns empty dictionary: - config file doesn't exist, or - 'enable-auto-...
def LoadSubversionAutoProperties(): """Returns the content of [auto-props] section of Subversion's config file as a dictionary. Returns: A dictionary whose key-value pair corresponds the [auto-props] section's key-value pair. In following cases, returns empty dictionary: - config file doesn't exist, or - 'enable-auto-...
458,045
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
458,046
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
458,047
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
458,048
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
def __init__(self, *args, **kwargs): raise NotImplementedException() # TODO(joi) Implement.
458,049
def CaptureMatchingLines(line): match = compiled_pattern.search(line) if match: file_list.append(match.group(1)) if line.startswith('svn: '): failure.append(line)
def CaptureMatchingLines(line): match = compiled_pattern.search(line) if match: file_list.append(match.group(1)) if line.startswith('svn: '): failure.append(line)
458,050
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
458,051
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
def __init__(self, commit=None, upstream_branch=None): self.commit = commit self.verbose = None self.default_presubmit = None self.may_prompt = None
458,052
def addKill(): """Add kill() method to subprocess.Popen for python <2.6""" if getattr(subprocess.Popen, 'kill', None): return if sys.platform.startswith('win'): def kill_win(process): import win32process return win32process.TerminateProcess(process._handle, -1) subprocess.kill = kill_win else: def kill_nix(process): im...
class GClientSmokeBase(unittest.TestCase): ROOT_DIR = os.path.join(TRIAL_DIR, 'smoke') def setUp(self): self.env = os.environ.copy() self.env['DEPOT_TOOLS_UPDATE'] = '0' self.root_dir = os.path.join(self.ROOT_DIR, self.id()) rmtree(self.root_dir) if not os.path.exists(self.ROOT_DIR): os.mkdir(self.ROOT_DIR) os.mkd...
458,053
def rmtree(path): """Delete a directory.""" if os.path.exists(path): shutil.rmtree(path)
class GClientSmoke(GClientSmokeBase): def testCommands(self): """This test is to make sure no new command was added.""" result = self.gclient(['help']) self.assertEquals(3189, len(result[0])) self.assertEquals(0, len(result[1])) self.assertEquals(0, result[2]) def testNotConfigured(self): res = ("", "Error: client not...
458,054
def write(path, content): f = open(path, 'wb') f.write(content) f.close()
class GClientSmokeSync(GClientSmokeBase): """sync is the most important command. Hence test it more.""" def testSyncSvn(self): """Test pure gclient svn checkout, example of Chromium checkout""" self.gclient(['config', self.svn_base + 'trunk/src/']) results = self.gclient(['sync']) self.assertEquals(0, results[2]) resul...
458,055
def write(path, content): f = open(path, 'wb') f.write(content) f.close()
def write(path, content): f = open(path, 'wb') f.write(content) f.close()
458,056
def setUp(self): self.setUpSVN() self.setUpGIT()
def setUp(self): self.setUpSVN() self.setUpGIT()
458,057
def tearDown(self): for i in self.svnserve: i.kill() for i in self.gitdaemon: i.kill() if not self.leak: rmtree(self.trial_dir)
def tearDown(self): for i in self.svnserve: i.kill() for i in self.gitdaemon: i.kill() if not self.leak: rmtree(self.trial_dir)
458,058
def setUpGIT(self): """Creates git repositories and start the servers.""" assert not self.gitdaemon join = os.path.join root = join(self.repos_dir, 'git') rmtree(root) os.mkdir(root) # Repo 1 repo = join(root, 'repo_1') subprocess.check_call(['git', 'init', '-q', repo]) write(join(repo, 'DEPS'), """
def setUpGIT(self): """Creates git repositories and start the servers.""" assert not self.gitdaemon join = os.path.join root = join(self.repos_dir, 'git') rmtree(root) os.mkdir(root) # Repo 1 repo = join(root, 'repo_1') subprocess.check_call(['git', 'init', '-q', repo]) write(join(repo, 'DEPS'), """
458,059
def setUpGIT(self): """Creates git repositories and start the servers.""" assert not self.gitdaemon join = os.path.join root = join(self.repos_dir, 'git') rmtree(root) os.mkdir(root) # Repo 1 repo = join(root, 'repo_1') subprocess.check_call(['git', 'init', '-q', repo]) write(join(repo, 'DEPS'), """
def setUpGIT(self): """Creates git repositories and start the servers.""" assert not self.gitdaemon join = os.path.join root = join(self.repos_dir, 'git') rmtree(root) os.mkdir(root) # Repo 1 repo = join(root, 'repo_1') subprocess.check_call(['git', 'init', '-q', repo]) write(join(repo, 'DEPS'), """
458,060
def RunAndGetFileList(verbose, args, cwd, file_list, stdout=None): """Runs svn checkout, update, or status, output to stdout.
def RunAndGetFileList(verbose, args, cwd, file_list, stdout=None): """Runs svn checkout, update, or status, output to stdout.
458,061
def testMembersChanged(self): members = [ 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite', 'FindGclientRoot', 'GetNamedNodeText', 'GetNodeNamedAttributeText', 'IsUsingGit', 'PathDifference', 'ParseXML', 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevision', 'SubprocessCall', 'SubprocessCallAndFilter'...
def testMembersChanged(self): members = [ 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', 'GetGClientRootAndEntries', 'GetNamedNodeText', 'GetNodeNamedAttributeText', 'IsUsingGit', 'PathDifference', 'ParseXML', 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevisio...
458,062
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",...
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",...
458,063
def _SaveEntries(self, entries): """Creates a .gclient_entries file to record the list of unique checkouts.
def _SaveEntries(self, entries): """Creates a .gclient_entries file to record the list of unique checkouts.
458,064
def GetURLAndRev(name, original_url): if not original_url: return None url, _ = gclient_utils.SplitUrlRevision(original_url) scm = gclient_scm.CreateSCM(original_url, self.root_dir(), name) return '%s@%s' % (url, scm.revinfo(self._options, [], None))
def GetURLAndRev(name, original_url): if not original_url: return None url, _ = gclient_utils.SplitUrlRevision(original_url) scm = gclient_scm.CreateSCM(original_url, self.root_dir(), name) return '%s@%s' % (url, scm.revinfo(self._options, [], None))
458,065
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
458,066
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
458,067
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
def update(self, options, args, file_list): """Runs svn to update or transparently checkout the working copy.
458,068
def updatesingle(self, options, args, file_list): checkout_path = os.path.join(self._root_dir, self.relpath) filename = args.pop() if scm.SVN.AssertVersion("1.5")[0]: if not os.path.exists(os.path.join(checkout_path, '.svn')): # Create an empty checkout and then update the one file we want. Future # operations will on...
def updatesingle(self, options, args, file_list): checkout_path = os.path.join(self._root_dir, self.relpath) filename = args.pop() if scm.SVN.AssertVersion("1.5")[0]: if not os.path.exists(os.path.join(checkout_path, '.svn')): # Create an empty checkout and then update the one file we want. Future # operations will on...
458,069
def CheckTreeIsOpen(input_api, output_api, url, closed): """Checks that an url's content doesn't match a regexp that would mean that the tree is closed.""" if not input_api.is_committing: return [] try: connection = input_api.urllib2.urlopen(url) status = connection.read() connection.close() if input_api.re.match(close...
def CheckTreeIsOpen(input_api, output_api, url, closed): """Checks that an url's content doesn't match a regexp that would mean that the tree is closed.""" if not input_api.is_committing: return [] try: connection = input_api.urllib2.urlopen(url) status = connection.read() connection.close() if input_api.re.match(close...
458,070
def RunOnDeps(self, command, args): """Runs a command on each dependency in a client and its dependencies.
def RunOnDeps(self, command, args): """Runs a command on each dependency in a client and its dependencies.
458,071
def testSync(self): # TODO(maruel): safesync. if not self.enabled: return self.gclient(['config', self.svn_base + 'trunk/src/']) # Test unversioned checkout. self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], ['running', 'running', # This is due to the way svn update is called for a # single file when File() i...
def testSync(self): # TODO(maruel): safesync. if not self.enabled: return self.gclient(['config', self.svn_base + 'trunk/src/']) # Test unversioned checkout. self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], ['running', 'running', # This is due to the way svn update is called for a # single file when File() i...
458,072
def _DiffItemInternal(filename, info, bogus_dir, full_move=False, revision=None): """Grabs the diff data.""" command = ["diff", "--config-dir", bogus_dir, filename] if revision: command.extend(['--revision', revision]) data = None if SVN.IsMovedInfo(info): if full_move: if info.get("Node Kind") == "directory": # Things...
def _DiffItemInternal(filename, info, bogus_dir, full_move=False, revision=None): """Grabs the diff data.""" command = ["diff", "--config-dir", bogus_dir, filename] if revision: command.extend(['--revision', revision]) data = None if SVN.IsMovedInfo(info): if full_move: if info.get("Node Kind") == "directory": # Things...
458,073
def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True): # TODO(maruel): Merge with Capture? if cwd is None: cwd = self.checkout_path stdout=None if redirect_stdout: stdout=subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = [self.COMMAND] cmd.extend(args) sp = subprocess.Popen(cmd, cwd=cwd, stdou...
def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True): # TODO(maruel): Merge with Capture? if cwd is None: cwd = self.checkout_path stdout=None if redirect_stdout: stdout=subprocess.PIPE if cwd == None: cwd = self.checkout_path cmd = [self.COMMAND] cmd.extend(args) logging.debug(cmd) try: sp = subprocess.P...
458,074
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...
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...
458,075
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...
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...
458,076
def main(argv): try: GetRepositoryRoot() except gclient_utils.Error: print('To use gcl, you need to be in a subversion checkout.') return 1 # Create the directories where we store information about changelists if it # doesn't exist. if not os.path.exists(GetInfoDir()): os.mkdir(GetInfoDir()) if not os.path.exists(GetC...
def main(argv): try: GetRepositoryRoot() except gclient_utils.Error: print('To use gcl, you need to be in a subversion checkout.') return 1 # Create the directories where we store information about changelists if it # doesn't exist. if not os.path.exists(GetInfoDir()): os.mkdir(GetInfoDir()) if not os.path.exists(GetC...
458,077
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 root = os.path.abspath(self.gclient_root) cur = os.path.abspat...
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) assert cur.startswit...
458,078
def Load(changename, local_root, fail_on_not_found, update_status): """Gets information about a changelist.
def Load(changename, local_root, fail_on_not_found, update_status): """Gets information about a changelist.
458,079
def Load(changename, local_root, fail_on_not_found, update_status): """Gets information about a changelist.
def Load(changename, local_root, fail_on_not_found, update_status): """Gets information about a changelist.
458,080
def CMDdescription(change_info): """Prints the description of the specified change to stdout.""" print change_info.description return 0
def CMDdescription(change_info): """Prints the description of the specified change to stdout.""" print change_info.description return 0
458,081
def CMDdelete(change_info): """Deletes a changelist.""" change_info.Delete() return 0
def CMDdelete(change_info): """Deletes a changelist.""" if not len(args) == 1: ErrorExit('You need to pass a change list name') os.remove(GetChangelistInfoFile(args[0])) return 0
458,082
def cleanup(self, options, args, file_list): """Cleanup working copy.""" __pychecker__ = 'unusednames=options,args,file_list' self._Run(['prune'], redirect_stdout=False) self._Run(['fsck'], redirect_stdout=False) self._Run(['gc'], redirect_stdout=False)
def cleanup(self, options, args, file_list): """'Cleanup' the repo. There's no real git equivalent for the svn cleanup command, do a no-op. """ __pychecker__ = 'unusednames=options,args,file_list' self._Run(['prune'], redirect_stdout=False) self._Run(['fsck'], redirect_stdout=False) self._Run(['gc'], redirect_stdout=F...
458,083
def cleanup(self, options, args, file_list): """Cleanup working copy.""" __pychecker__ = 'unusednames=options,args,file_list' self._Run(['prune'], redirect_stdout=False) self._Run(['fsck'], redirect_stdout=False) self._Run(['gc'], redirect_stdout=False)
def cleanup(self, options, args, file_list): """Cleanup working copy.""" __pychecker__ = 'unusednames=options,args,file_list' self._Run(['prune'], redirect_stdout=False) self._Run(['fsck'], redirect_stdout=False) self._Run(['gc'], redirect_stdout=False)
458,084
def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy.
def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy.
458,085
def hierarchy(self): "Returns a human-readable hierarchical reference to a Dependency." out = '%s(%s)' % (self.name, self.url) i = self.parent while i and i.name: out = '%s(%s) -> %s' % (i.name, i.url, out) i = i.parent return out
def hierarchy(self): """Returns a human-readable hierarchical reference to a Dependency.""" out = '%s(%s)' % (self.name, self.url) i = self.parent while i and i.name: out = '%s(%s) -> %s' % (i.name, i.url, out) i = i.parent return out
458,086
def _Handle(self, output_stream, input_stream, may_prompt=True): """Writes this result to the output stream.
def _Handle(self, output_stream, input_stream, may_prompt=True): """Writes this result to the output stream.
458,087
def main(argv): if not argv: argv = ['help'] command = Command(argv[0]) # Help can be run from anywhere. if command == CMDhelp: return command(argv[1:]) try: GetRepositoryRoot() except gclient_utils.Error: print('To use gcl, you need to be in a subversion checkout.') return 1 # Create the directories where we store i...
def main(argv): if not argv: argv = ['help'] command = Command(argv[0]) # Help can be run from anywhere. if command == CMDhelp: return command(argv[1:]) try: GetRepositoryRoot() except gclient_utils.Error: print >> sys.stderr, 'To use gcl, you need to be in a subversion checkout.' return 1 # Create the directories wh...
458,088
def main(argv): if not argv: argv = ['help'] command = Command(argv[0]) # Help can be run from anywhere. if command == CMDhelp: return command(argv[1:]) try: GetRepositoryRoot() except gclient_utils.Error: print('To use gcl, you need to be in a subversion checkout.') return 1 # Create the directories where we store i...
def main(argv): if not argv: argv = ['help'] command = Command(argv[0]) # Help can be run from anywhere. if command == CMDhelp: return command(argv[1:]) try: GetRepositoryRoot() except gclient_utils.Error: print('To use gcl, you need to be in a subversion checkout.') return 1 # Create the directories where we store i...
458,089
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...
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...
458,090
def CheckForException(): """Runs at exit. Look if there was an exception active.""" 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(): """Runs at exit. Look if there was an exception active.""" 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(last_value, ''.join(traceback.format_tb(last_tb)))
458,091
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...
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...
458,092
def main(argv=None): if argv is None: argv = sys.argv if len(argv) == 1: Help() return 0; try: # Create the directories where we store information about changelists if it # doesn't exist. if not os.path.exists(GetInfoDir()): os.mkdir(GetInfoDir()) if not os.path.exists(GetChangesDir()): os.mkdir(GetChangesDir()) if n...
def main(argv=None): if argv is None: argv = sys.argv if len(argv) == 1: Help() return 0; try: # Create the directories where we store information about changelists if it # doesn't exist. if not os.path.exists(GetInfoDir()): os.mkdir(GetInfoDir()) if not os.path.exists(GetChangesDir()): os.mkdir(GetChangesDir()) if n...
458,093
def Register(): """Registers the callback at exit. Calling it multiple times is no-op.""" global _REGISTERED if _REGISTERED: return _REGISTERED = True atexit.register(CheckForException)
def Register(): """Registers the callback at exit. Calling it multiple times is no-op.""" global _REGISTERED if _REGISTERED: return _REGISTERED = True atexit.register(CheckForException)
458,094
def write(self, out): """Thread-safe.""" self.stdout.write(out) should_flush = False with self.lock: if (time.time() - self.last_flushed_at) > self.delay: should_flush = True self.last_flushed_at = time.time() if should_flush: self.stdout.flush()
def write(self, out): """Thread-safe.""" self.stdout.write(out) should_flush = False self.lock.acquire() try: if (time.time() - self.last_flushed_at) > self.delay: should_flush = True self.last_flushed_at = time.time() if should_flush: self.stdout.flush()
458,095
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
458,096
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
458,097
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
458,098
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
def __init__(self): self.win = 0 self.loss = 0 self.rate = 1500
458,099