body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
@subcommand.usage('[upstream branch to apply against]')
def CMDdcommit(parser, args):
'Commits the current changelist via git-svn.'
if (not settings.GetIsGitSvn()):
if git_footers.get_footer_svn_id():
message = "This repository appears to be a git-svn mirror, but no\nupstream SVN master is s... | 5,863,675,845,697,642,000 | Commits the current changelist via git-svn. | git_cl.py | CMDdcommit | wuyong2k/chromium_depot_tool | python | @subcommand.usage('[upstream branch to apply against]')
def CMDdcommit(parser, args):
if (not settings.GetIsGitSvn()):
if git_footers.get_footer_svn_id():
message = "This repository appears to be a git-svn mirror, but no\nupstream SVN master is set. You probably need to run 'git auto-svn' o... |
@subcommand.usage('[upstream branch to apply against]')
def CMDland(parser, args):
'Commits the current changelist via git.'
if (settings.GetIsGitSvn() or git_footers.get_footer_svn_id()):
print('This appears to be an SVN repository.')
print("Are you sure you didn't mean 'git cl dcommit'?")
... | -2,676,884,157,090,033,700 | Commits the current changelist via git. | git_cl.py | CMDland | wuyong2k/chromium_depot_tool | python | @subcommand.usage('[upstream branch to apply against]')
def CMDland(parser, args):
if (settings.GetIsGitSvn() or git_footers.get_footer_svn_id()):
print('This appears to be an SVN repository.')
print("Are you sure you didn't mean 'git cl dcommit'?")
print('(Ignore if this is the first c... |
@subcommand.usage('<patch url or issue id or issue url>')
def CMDpatch(parser, args):
'Patches in a code review.'
parser.add_option('-b', dest='newbranch', help='create a new branch off trunk for the patch')
parser.add_option('-f', '--force', action='store_true', help='with -b, clobber any existing branch')... | 7,364,788,965,587,228,000 | Patches in a code review. | git_cl.py | CMDpatch | wuyong2k/chromium_depot_tool | python | @subcommand.usage('<patch url or issue id or issue url>')
def CMDpatch(parser, args):
parser.add_option('-b', dest='newbranch', help='create a new branch off trunk for the patch')
parser.add_option('-f', '--force', action='store_true', help='with -b, clobber any existing branch')
parser.add_option('-d'... |
def CMDrebase(parser, args):
'Rebases current branch on top of svn repo.'
return RunGitWithCode((['svn', 'rebase'] + args))[1] | 5,346,108,559,491,527,000 | Rebases current branch on top of svn repo. | git_cl.py | CMDrebase | wuyong2k/chromium_depot_tool | python | def CMDrebase(parser, args):
return RunGitWithCode((['svn', 'rebase'] + args))[1] |
def GetTreeStatus(url=None):
"Fetches the tree status and returns either 'open', 'closed',\n 'unknown' or 'unset'."
url = (url or settings.GetTreeStatusUrl(error_ok=True))
if url:
status = urllib2.urlopen(url).read().lower()
if ((status.find('closed') != (- 1)) or (status == '0')):
... | 722,695,825,156,314,800 | Fetches the tree status and returns either 'open', 'closed',
'unknown' or 'unset'. | git_cl.py | GetTreeStatus | wuyong2k/chromium_depot_tool | python | def GetTreeStatus(url=None):
"Fetches the tree status and returns either 'open', 'closed',\n 'unknown' or 'unset'."
url = (url or settings.GetTreeStatusUrl(error_ok=True))
if url:
status = urllib2.urlopen(url).read().lower()
if ((status.find('closed') != (- 1)) or (status == '0')):
... |
def GetTreeStatusReason():
'Fetches the tree status from a json url and returns the message\n with the reason for the tree to be opened or closed.'
url = settings.GetTreeStatusUrl()
json_url = urlparse.urljoin(url, '/current?format=json')
connection = urllib2.urlopen(json_url)
status = json.loads(c... | 331,425,300,037,896,640 | Fetches the tree status from a json url and returns the message
with the reason for the tree to be opened or closed. | git_cl.py | GetTreeStatusReason | wuyong2k/chromium_depot_tool | python | def GetTreeStatusReason():
'Fetches the tree status from a json url and returns the message\n with the reason for the tree to be opened or closed.'
url = settings.GetTreeStatusUrl()
json_url = urlparse.urljoin(url, '/current?format=json')
connection = urllib2.urlopen(json_url)
status = json.loads(c... |
def GetBuilderMaster(bot_list):
'For a given builder, fetch the master from AE if available.'
map_url = 'https://builders-map.appspot.com/'
try:
master_map = json.load(urllib2.urlopen(map_url))
except urllib2.URLError as e:
return (None, ('Failed to fetch builder-to-master map from %s. E... | 8,976,772,511,821,153,000 | For a given builder, fetch the master from AE if available. | git_cl.py | GetBuilderMaster | wuyong2k/chromium_depot_tool | python | def GetBuilderMaster(bot_list):
map_url = 'https://builders-map.appspot.com/'
try:
master_map = json.load(urllib2.urlopen(map_url))
except urllib2.URLError as e:
return (None, ('Failed to fetch builder-to-master map from %s. Error: %s.' % (map_url, e)))
except ValueError as e:
... |
def CMDtree(parser, args):
'Shows the status of the tree.'
(_, args) = parser.parse_args(args)
status = GetTreeStatus()
if ('unset' == status):
print('You must configure your tree status URL by running "git cl config".')
return 2
print(('The tree is %s' % status))
print()
pri... | 3,916,277,630,828,864,500 | Shows the status of the tree. | git_cl.py | CMDtree | wuyong2k/chromium_depot_tool | python | def CMDtree(parser, args):
(_, args) = parser.parse_args(args)
status = GetTreeStatus()
if ('unset' == status):
print('You must configure your tree status URL by running "git cl config".')
return 2
print(('The tree is %s' % status))
print()
print(GetTreeStatusReason())
i... |
def CMDtry(parser, args):
'Triggers try jobs through BuildBucket.'
group = optparse.OptionGroup(parser, 'Try job options')
group.add_option('-b', '--bot', action='append', help="IMPORTANT: specify ONE builder per --bot flag. Use it multiple times to specify multiple builders. ex: '-b win_rel -b win_layout'.... | -4,868,945,639,271,806,000 | Triggers try jobs through BuildBucket. | git_cl.py | CMDtry | wuyong2k/chromium_depot_tool | python | def CMDtry(parser, args):
group = optparse.OptionGroup(parser, 'Try job options')
group.add_option('-b', '--bot', action='append', help="IMPORTANT: specify ONE builder per --bot flag. Use it multiple times to specify multiple builders. ex: '-b win_rel -b win_layout'. See the try server waterfall for the bu... |
@subcommand.usage('[new upstream branch]')
def CMDupstream(parser, args):
'Prints or sets the name of the upstream branch, if any.'
(_, args) = parser.parse_args(args)
if (len(args) > 1):
parser.error(('Unrecognized args: %s' % ' '.join(args)))
cl = Changelist()
if args:
branch = cl.... | 6,015,972,814,959,564,000 | Prints or sets the name of the upstream branch, if any. | git_cl.py | CMDupstream | wuyong2k/chromium_depot_tool | python | @subcommand.usage('[new upstream branch]')
def CMDupstream(parser, args):
(_, args) = parser.parse_args(args)
if (len(args) > 1):
parser.error(('Unrecognized args: %s' % ' '.join(args)))
cl = Changelist()
if args:
branch = cl.GetBranch()
RunGit(['branch', '--set-upstream', b... |
def CMDweb(parser, args):
'Opens the current CL in the web browser.'
(_, args) = parser.parse_args(args)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
issue_url = Changelist().GetIssueURL()
if (not issue_url):
print('ERROR No issue to open', file=sys.stderr)
... | -2,022,026,822,592,401,400 | Opens the current CL in the web browser. | git_cl.py | CMDweb | wuyong2k/chromium_depot_tool | python | def CMDweb(parser, args):
(_, args) = parser.parse_args(args)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
issue_url = Changelist().GetIssueURL()
if (not issue_url):
print('ERROR No issue to open', file=sys.stderr)
return 1
webbrowser.open(issue_url)... |
def CMDset_commit(parser, args):
'Sets the commit bit to trigger the Commit Queue.'
parser.add_option('-d', '--dry-run', action='store_true', help='trigger in dry run mode')
parser.add_option('-c', '--clear', action='store_true', help='stop CQ run, if any')
auth.add_auth_options(parser)
(options, ar... | -7,858,453,068,095,442,000 | Sets the commit bit to trigger the Commit Queue. | git_cl.py | CMDset_commit | wuyong2k/chromium_depot_tool | python | def CMDset_commit(parser, args):
parser.add_option('-d', '--dry-run', action='store_true', help='trigger in dry run mode')
parser.add_option('-c', '--clear', action='store_true', help='stop CQ run, if any')
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = au... |
def CMDset_close(parser, args):
'Closes the issue.'
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options(options)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
cl = Changelist(auth_config=auth_conf... | 1,098,923,931,220,576,800 | Closes the issue. | git_cl.py | CMDset_close | wuyong2k/chromium_depot_tool | python | def CMDset_close(parser, args):
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options(options)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
cl = Changelist(auth_config=auth_config)
cl.GetDescr... |
def CMDdiff(parser, args):
'Shows differences between local tree and last upload.'
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options(options)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
if git... | 4,786,604,619,235,999,000 | Shows differences between local tree and last upload. | git_cl.py | CMDdiff | wuyong2k/chromium_depot_tool | python | def CMDdiff(parser, args):
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options(options)
if args:
parser.error(('Unrecognized args: %s' % ' '.join(args)))
if git_common.is_dirty_git_tree('diff'):
return 1
... |
def CMDowners(parser, args):
'Interactively find the owners for reviewing.'
parser.add_option('--no-color', action='store_true', help='Use this option to disable color output')
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options... | -8,540,179,567,444,445,000 | Interactively find the owners for reviewing. | git_cl.py | CMDowners | wuyong2k/chromium_depot_tool | python | def CMDowners(parser, args):
parser.add_option('--no-color', action='store_true', help='Use this option to disable color output')
auth.add_auth_options(parser)
(options, args) = parser.parse_args(args)
auth_config = auth.extract_auth_config_from_options(options)
author = (RunGit(['config', 'use... |
def BuildGitDiffCmd(diff_type, upstream_commit, args):
'Generates a diff command.'
diff_cmd = ['diff', '--no-ext-diff', '--no-prefix', diff_type, upstream_commit, '--']
if args:
for arg in args:
if (os.path.isdir(arg) or os.path.isfile(arg)):
diff_cmd.append(arg)
... | 5,490,146,766,828,878,000 | Generates a diff command. | git_cl.py | BuildGitDiffCmd | wuyong2k/chromium_depot_tool | python | def BuildGitDiffCmd(diff_type, upstream_commit, args):
diff_cmd = ['diff', '--no-ext-diff', '--no-prefix', diff_type, upstream_commit, '--']
if args:
for arg in args:
if (os.path.isdir(arg) or os.path.isfile(arg)):
diff_cmd.append(arg)
else:
D... |
def MatchingFileType(file_name, extensions):
'Returns true if the file name ends with one of the given extensions.'
return bool([ext for ext in extensions if file_name.lower().endswith(ext)]) | 3,653,199,087,222,800,000 | Returns true if the file name ends with one of the given extensions. | git_cl.py | MatchingFileType | wuyong2k/chromium_depot_tool | python | def MatchingFileType(file_name, extensions):
return bool([ext for ext in extensions if file_name.lower().endswith(ext)]) |
@subcommand.usage('[files or directories to diff]')
def CMDformat(parser, args):
'Runs auto-formatting tools (clang-format etc.) on the diff.'
CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto', '.java']
GN_EXTS = ['.gn', '.gni', '.typemap']
parser.add_option('--full', action='store_true', help='Reforma... | -8,500,997,385,933,100,000 | Runs auto-formatting tools (clang-format etc.) on the diff. | git_cl.py | CMDformat | wuyong2k/chromium_depot_tool | python | @subcommand.usage('[files or directories to diff]')
def CMDformat(parser, args):
CLANG_EXTS = ['.cc', '.cpp', '.h', '.mm', '.proto', '.java']
GN_EXTS = ['.gn', '.gni', '.typemap']
parser.add_option('--full', action='store_true', help='Reformat the full content of all touched files')
parser.add_opti... |
@subcommand.usage('<codereview url or issue id>')
def CMDcheckout(parser, args):
'Checks out a branch associated with a given Rietveld or Gerrit issue.'
(_, args) = parser.parse_args(args)
if (len(args) != 1):
parser.print_help()
return 1
issue_arg = ParseIssueNumberArgument(args[0])
... | 2,895,987,222,502,879,700 | Checks out a branch associated with a given Rietveld or Gerrit issue. | git_cl.py | CMDcheckout | wuyong2k/chromium_depot_tool | python | @subcommand.usage('<codereview url or issue id>')
def CMDcheckout(parser, args):
(_, args) = parser.parse_args(args)
if (len(args) != 1):
parser.print_help()
return 1
issue_arg = ParseIssueNumberArgument(args[0])
if (not issue_arg.valid):
parser.print_help()
return 1... |
def pop(title, f, color=None, **kwargs):
'Pop matching builds from `builds` dict and print them.'
if ((not options.color) or (color is None)):
colorize = str
else:
colorize = (lambda x: ('%s%s%s' % (color, x, Fore.RESET)))
result = []
for b in builds.values():
if all(((b.get(... | -6,675,543,092,929,439,000 | Pop matching builds from `builds` dict and print them. | git_cl.py | pop | wuyong2k/chromium_depot_tool | python | def pop(title, f, color=None, **kwargs):
if ((not options.color) or (color is None)):
colorize = str
else:
colorize = (lambda x: ('%s%s%s' % (color, x, Fore.RESET)))
result = []
for b in builds.values():
if all(((b.get(k) == v) for (k, v) in kwargs.iteritems())):
... |
def LazyUpdateIfNeeded(self):
'Updates the settings from a codereview.settings file, if available.'
if (not self.updated):
autoupdate = RunGit(['config', 'rietveld.autoupdate'], error_ok=True).strip().lower()
cr_settings_file = FindCodereviewSettingsFile()
if ((autoupdate != 'false') and... | -3,136,644,429,528,896,000 | Updates the settings from a codereview.settings file, if available. | git_cl.py | LazyUpdateIfNeeded | wuyong2k/chromium_depot_tool | python | def LazyUpdateIfNeeded(self):
if (not self.updated):
autoupdate = RunGit(['config', 'rietveld.autoupdate'], error_ok=True).strip().lower()
cr_settings_file = FindCodereviewSettingsFile()
if ((autoupdate != 'false') and cr_settings_file):
LoadCodereviewSettingsFromFile(cr_set... |
def GetGitMirror(self, remote='origin'):
'If this checkout is from a local git mirror, return a Mirror object.'
local_url = RunGit(['config', '--get', ('remote.%s.url' % remote)]).strip()
if (not os.path.isdir(local_url)):
return None
git_cache.Mirror.SetCachePath(os.path.dirname(local_url))
... | -2,647,150,121,721,829,000 | If this checkout is from a local git mirror, return a Mirror object. | git_cl.py | GetGitMirror | wuyong2k/chromium_depot_tool | python | def GetGitMirror(self, remote='origin'):
local_url = RunGit(['config', '--get', ('remote.%s.url' % remote)]).strip()
if (not os.path.isdir(local_url)):
return None
git_cache.Mirror.SetCachePath(os.path.dirname(local_url))
remote_url = git_cache.Mirror.CacheDirToUrl(local_url)
mirror = g... |
def GetIsGitSvn(self):
"Return true if this repo looks like it's using git-svn."
if (self.is_git_svn is None):
if self.GetPendingRefPrefix():
self.is_git_svn = False
else:
self.is_git_svn = (RunGitWithCode(['config', '--local', '--get-regexp', '^svn-remote\\.'])[0] == 0)
... | -7,692,615,956,078,929,000 | Return true if this repo looks like it's using git-svn. | git_cl.py | GetIsGitSvn | wuyong2k/chromium_depot_tool | python | def GetIsGitSvn(self):
if (self.is_git_svn is None):
if self.GetPendingRefPrefix():
self.is_git_svn = False
else:
self.is_git_svn = (RunGitWithCode(['config', '--local', '--get-regexp', '^svn-remote\\.'])[0] == 0)
return self.is_git_svn |
def GetIsSkipDependencyUpload(self, branch_name):
'Returns true if specified branch should skip dep uploads.'
return self._GetBranchConfig(branch_name, 'skip-deps-uploads', error_ok=True) | 2,428,893,246,341,684,000 | Returns true if specified branch should skip dep uploads. | git_cl.py | GetIsSkipDependencyUpload | wuyong2k/chromium_depot_tool | python | def GetIsSkipDependencyUpload(self, branch_name):
return self._GetBranchConfig(branch_name, 'skip-deps-uploads', error_ok=True) |
def GetIsGerrit(self):
'Return true if this repo is assosiated with gerrit code review system.'
if (self.is_gerrit is None):
self.is_gerrit = self._GetConfig('gerrit.host', error_ok=True)
return self.is_gerrit | 2,969,505,047,769,960,000 | Return true if this repo is assosiated with gerrit code review system. | git_cl.py | GetIsGerrit | wuyong2k/chromium_depot_tool | python | def GetIsGerrit(self):
if (self.is_gerrit is None):
self.is_gerrit = self._GetConfig('gerrit.host', error_ok=True)
return self.is_gerrit |
def GetSquashGerritUploads(self):
'Return true if uploads to Gerrit should be squashed by default.'
if (self.squash_gerrit_uploads is None):
self.squash_gerrit_uploads = self.GetSquashGerritUploadsOverride()
if (self.squash_gerrit_uploads is None):
self.squash_gerrit_uploads = (not (... | 6,245,361,291,211,359,000 | Return true if uploads to Gerrit should be squashed by default. | git_cl.py | GetSquashGerritUploads | wuyong2k/chromium_depot_tool | python | def GetSquashGerritUploads(self):
if (self.squash_gerrit_uploads is None):
self.squash_gerrit_uploads = self.GetSquashGerritUploadsOverride()
if (self.squash_gerrit_uploads is None):
self.squash_gerrit_uploads = (not (RunGit(['config', '--bool', 'gerrit.squash-uploads'], error_ok=Tr... |
def GetSquashGerritUploadsOverride(self):
'Return True or False if codereview.settings should be overridden.\n\n Returns None if no override has been defined.\n '
result = RunGit(['config', '--bool', 'gerrit.override-squash-uploads'], error_ok=True).strip()
if (result == 'true'):
return True
... | 6,591,214,156,574,674,000 | Return True or False if codereview.settings should be overridden.
Returns None if no override has been defined. | git_cl.py | GetSquashGerritUploadsOverride | wuyong2k/chromium_depot_tool | python | def GetSquashGerritUploadsOverride(self):
'Return True or False if codereview.settings should be overridden.\n\n Returns None if no override has been defined.\n '
result = RunGit(['config', '--bool', 'gerrit.override-squash-uploads'], error_ok=True).strip()
if (result == 'true'):
return True
... |
def GetGerritSkipEnsureAuthenticated(self):
'Return True if EnsureAuthenticated should not be done for Gerrit\n uploads.'
if (self.gerrit_skip_ensure_authenticated is None):
self.gerrit_skip_ensure_authenticated = (RunGit(['config', '--bool', 'gerrit.skip-ensure-authenticated'], error_ok=True).strip(... | -5,341,155,329,583,082,000 | Return True if EnsureAuthenticated should not be done for Gerrit
uploads. | git_cl.py | GetGerritSkipEnsureAuthenticated | wuyong2k/chromium_depot_tool | python | def GetGerritSkipEnsureAuthenticated(self):
'Return True if EnsureAuthenticated should not be done for Gerrit\n uploads.'
if (self.gerrit_skip_ensure_authenticated is None):
self.gerrit_skip_ensure_authenticated = (RunGit(['config', '--bool', 'gerrit.skip-ensure-authenticated'], error_ok=True).strip(... |
def GetGitEditor(self):
'Return the editor specified in the git config, or None if none is.'
if (self.git_editor is None):
self.git_editor = self._GetConfig('core.editor', error_ok=True)
return (self.git_editor or None) | -3,534,564,734,461,231,600 | Return the editor specified in the git config, or None if none is. | git_cl.py | GetGitEditor | wuyong2k/chromium_depot_tool | python | def GetGitEditor(self):
if (self.git_editor is None):
self.git_editor = self._GetConfig('core.editor', error_ok=True)
return (self.git_editor or None) |
def __init__(self, branchref=None, issue=None, codereview=None, **kwargs):
"Create a new ChangeList instance.\n\n If issue is given, the codereview must be given too.\n\n If `codereview` is given, it must be 'rietveld' or 'gerrit'.\n Otherwise, it's decided based on current configuration of the local branc... | -1,281,385,223,439,482,000 | Create a new ChangeList instance.
If issue is given, the codereview must be given too.
If `codereview` is given, it must be 'rietveld' or 'gerrit'.
Otherwise, it's decided based on current configuration of the local branch,
with default being 'rietveld' for backwards compatibility.
See _load_codereview_impl for more ... | git_cl.py | __init__ | wuyong2k/chromium_depot_tool | python | def __init__(self, branchref=None, issue=None, codereview=None, **kwargs):
"Create a new ChangeList instance.\n\n If issue is given, the codereview must be given too.\n\n If `codereview` is given, it must be 'rietveld' or 'gerrit'.\n Otherwise, it's decided based on current configuration of the local branc... |
def GetCCList(self):
"Return the users cc'd on this CL.\n\n Return is a string suitable for passing to gcl with the --cc flag.\n "
if (self.cc is None):
base_cc = settings.GetDefaultCCList()
more_cc = ','.join(self.watchers)
self.cc = (','.join(filter(None, (base_cc, more_cc))) or ... | -1,000,866,675,075,656,300 | Return the users cc'd on this CL.
Return is a string suitable for passing to gcl with the --cc flag. | git_cl.py | GetCCList | wuyong2k/chromium_depot_tool | python | def GetCCList(self):
"Return the users cc'd on this CL.\n\n Return is a string suitable for passing to gcl with the --cc flag.\n "
if (self.cc is None):
base_cc = settings.GetDefaultCCList()
more_cc = ','.join(self.watchers)
self.cc = (','.join(filter(None, (base_cc, more_cc))) or ... |
def GetCCListWithoutDefault(self):
"Return the users cc'd on this CL excluding default ones."
if (self.cc is None):
self.cc = ','.join(self.watchers)
return self.cc | -4,830,934,428,076,575,000 | Return the users cc'd on this CL excluding default ones. | git_cl.py | GetCCListWithoutDefault | wuyong2k/chromium_depot_tool | python | def GetCCListWithoutDefault(self):
if (self.cc is None):
self.cc = ','.join(self.watchers)
return self.cc |
def SetWatchers(self, watchers):
"Set the list of email addresses that should be cc'd based on the changed\n files in this CL.\n "
self.watchers = watchers | -8,987,320,363,241,563,000 | Set the list of email addresses that should be cc'd based on the changed
files in this CL. | git_cl.py | SetWatchers | wuyong2k/chromium_depot_tool | python | def SetWatchers(self, watchers):
"Set the list of email addresses that should be cc'd based on the changed\n files in this CL.\n "
self.watchers = watchers |
def GetBranch(self):
"Returns the short branch name, e.g. 'master'."
if (not self.branch):
branchref = GetCurrentBranchRef()
if (not branchref):
return None
self.branchref = branchref
self.branch = ShortBranchName(self.branchref)
return self.branch | 3,819,321,995,054,192,600 | Returns the short branch name, e.g. 'master'. | git_cl.py | GetBranch | wuyong2k/chromium_depot_tool | python | def GetBranch(self):
if (not self.branch):
branchref = GetCurrentBranchRef()
if (not branchref):
return None
self.branchref = branchref
self.branch = ShortBranchName(self.branchref)
return self.branch |
def GetBranchRef(self):
"Returns the full branch name, e.g. 'refs/heads/master'."
self.GetBranch()
return self.branchref | -7,243,469,493,687,418,000 | Returns the full branch name, e.g. 'refs/heads/master'. | git_cl.py | GetBranchRef | wuyong2k/chromium_depot_tool | python | def GetBranchRef(self):
self.GetBranch()
return self.branchref |
def ClearBranch(self):
'Clears cached branch data of this object.'
self.branch = self.branchref = None | -3,159,752,250,145,031,700 | Clears cached branch data of this object. | git_cl.py | ClearBranch | wuyong2k/chromium_depot_tool | python | def ClearBranch(self):
self.branch = self.branchref = None |
@staticmethod
def FetchUpstreamTuple(branch):
"Returns a tuple containing remote and remote ref,\n e.g. 'origin', 'refs/heads/master'\n "
remote = '.'
upstream_branch = RunGit(['config', ('branch.%s.merge' % branch)], error_ok=True).strip()
if upstream_branch:
remote = RunGit(['config',... | 3,438,684,381,524,826,600 | Returns a tuple containing remote and remote ref,
e.g. 'origin', 'refs/heads/master' | git_cl.py | FetchUpstreamTuple | wuyong2k/chromium_depot_tool | python | @staticmethod
def FetchUpstreamTuple(branch):
"Returns a tuple containing remote and remote ref,\n e.g. 'origin', 'refs/heads/master'\n "
remote = '.'
upstream_branch = RunGit(['config', ('branch.%s.merge' % branch)], error_ok=True).strip()
if upstream_branch:
remote = RunGit(['config',... |
def GitSanityChecks(self, upstream_git_obj):
'Checks git repo status and ensures diff is from local commits.'
if (upstream_git_obj is None):
if (self.GetBranch() is None):
print('ERROR: unable to determine current branch (detached HEAD?)', file=sys.stderr)
else:
print('ER... | 4,551,052,420,264,305,700 | Checks git repo status and ensures diff is from local commits. | git_cl.py | GitSanityChecks | wuyong2k/chromium_depot_tool | python | def GitSanityChecks(self, upstream_git_obj):
if (upstream_git_obj is None):
if (self.GetBranch() is None):
print('ERROR: unable to determine current branch (detached HEAD?)', file=sys.stderr)
else:
print('ERROR: no upstream branch', file=sys.stderr)
return False
... |
def GetGitBaseUrlFromConfig(self):
'Return the configured base URL from branch.<branchname>.baseurl.\n\n Returns None if it is not set.\n '
return RunGit(['config', ('branch.%s.base-url' % self.GetBranch())], error_ok=True).strip() | -7,890,018,859,449,928,000 | Return the configured base URL from branch.<branchname>.baseurl.
Returns None if it is not set. | git_cl.py | GetGitBaseUrlFromConfig | wuyong2k/chromium_depot_tool | python | def GetGitBaseUrlFromConfig(self):
'Return the configured base URL from branch.<branchname>.baseurl.\n\n Returns None if it is not set.\n '
return RunGit(['config', ('branch.%s.base-url' % self.GetBranch())], error_ok=True).strip() |
def GetGitSvnRemoteUrl(self):
'Return the configured git-svn remote URL parsed from git svn info.\n\n Returns None if it is not set.\n '
data = RunGit(['svn', 'info'], cwd=settings.GetRoot())
if data:
keys = dict((line.split(': ', 1) for line in data.splitlines() if (': ' in line)))
re... | -5,987,009,470,614,354,000 | Return the configured git-svn remote URL parsed from git svn info.
Returns None if it is not set. | git_cl.py | GetGitSvnRemoteUrl | wuyong2k/chromium_depot_tool | python | def GetGitSvnRemoteUrl(self):
'Return the configured git-svn remote URL parsed from git svn info.\n\n Returns None if it is not set.\n '
data = RunGit(['svn', 'info'], cwd=settings.GetRoot())
if data:
keys = dict((line.split(': ', 1) for line in data.splitlines() if (': ' in line)))
re... |
def GetRemoteUrl(self):
"Return the configured remote URL, e.g. 'git://example.org/foo.git/'.\n\n Returns None if there is no remote.\n "
(remote, _) = self.GetRemoteBranch()
url = RunGit(['config', ('remote.%s.url' % remote)], error_ok=True).strip()
if os.path.isdir(url):
url = RunGit(['c... | -6,965,647,758,296,576,000 | Return the configured remote URL, e.g. 'git://example.org/foo.git/'.
Returns None if there is no remote. | git_cl.py | GetRemoteUrl | wuyong2k/chromium_depot_tool | python | def GetRemoteUrl(self):
"Return the configured remote URL, e.g. 'git://example.org/foo.git/'.\n\n Returns None if there is no remote.\n "
(remote, _) = self.GetRemoteBranch()
url = RunGit(['config', ('remote.%s.url' % remote)], error_ok=True).strip()
if os.path.isdir(url):
url = RunGit(['c... |
def GetIssue(self):
'Returns the issue number as a int or None if not set.'
if ((self.issue is None) and (not self.lookedup_issue)):
issue = RunGit(['config', self._codereview_impl.IssueSetting(self.GetBranch())], error_ok=True).strip()
self.issue = ((int(issue) or None) if issue else None)
... | -2,721,788,952,252,530,700 | Returns the issue number as a int or None if not set. | git_cl.py | GetIssue | wuyong2k/chromium_depot_tool | python | def GetIssue(self):
if ((self.issue is None) and (not self.lookedup_issue)):
issue = RunGit(['config', self._codereview_impl.IssueSetting(self.GetBranch())], error_ok=True).strip()
self.issue = ((int(issue) or None) if issue else None)
self.lookedup_issue = True
return self.issue |
def GetIssueURL(self):
'Get the URL for a particular issue.'
issue = self.GetIssue()
if (not issue):
return None
return ('%s/%s' % (self._codereview_impl.GetCodereviewServer(), issue)) | 5,451,291,022,107,055,000 | Get the URL for a particular issue. | git_cl.py | GetIssueURL | wuyong2k/chromium_depot_tool | python | def GetIssueURL(self):
issue = self.GetIssue()
if (not issue):
return None
return ('%s/%s' % (self._codereview_impl.GetCodereviewServer(), issue)) |
def GetPatchset(self):
'Returns the patchset number as a int or None if not set.'
if ((self.patchset is None) and (not self.lookedup_patchset)):
patchset = RunGit(['config', self._codereview_impl.PatchsetSetting()], error_ok=True).strip()
self.patchset = ((int(patchset) or None) if patchset else... | 8,813,032,372,331,586,000 | Returns the patchset number as a int or None if not set. | git_cl.py | GetPatchset | wuyong2k/chromium_depot_tool | python | def GetPatchset(self):
if ((self.patchset is None) and (not self.lookedup_patchset)):
patchset = RunGit(['config', self._codereview_impl.PatchsetSetting()], error_ok=True).strip()
self.patchset = ((int(patchset) or None) if patchset else None)
self.lookedup_patchset = True
return se... |
def SetPatchset(self, patchset):
"Set this branch's patchset. If patchset=0, clears the patchset."
patchset_setting = self._codereview_impl.PatchsetSetting()
if patchset:
RunGit(['config', patchset_setting, str(patchset)])
self.patchset = patchset
else:
RunGit(['config', '--unse... | 707,502,986,647,797,200 | Set this branch's patchset. If patchset=0, clears the patchset. | git_cl.py | SetPatchset | wuyong2k/chromium_depot_tool | python | def SetPatchset(self, patchset):
patchset_setting = self._codereview_impl.PatchsetSetting()
if patchset:
RunGit(['config', patchset_setting, str(patchset)])
self.patchset = patchset
else:
RunGit(['config', '--unset', patchset_setting], stderr=subprocess2.PIPE, error_ok=True)
... |
def SetIssue(self, issue=None):
"Set this branch's issue. If issue isn't given, clears the issue."
issue_setting = self._codereview_impl.IssueSetting(self.GetBranch())
codereview_setting = self._codereview_impl.GetCodereviewServerSetting()
if issue:
self.issue = issue
RunGit(['config', ... | 3,311,791,937,509,908,000 | Set this branch's issue. If issue isn't given, clears the issue. | git_cl.py | SetIssue | wuyong2k/chromium_depot_tool | python | def SetIssue(self, issue=None):
issue_setting = self._codereview_impl.IssueSetting(self.GetBranch())
codereview_setting = self._codereview_impl.GetCodereviewServerSetting()
if issue:
self.issue = issue
RunGit(['config', issue_setting, str(issue)])
codereview_server = self._coder... |
def RunHook(self, committing, may_prompt, verbose, change):
'Calls sys.exit() if the hook fails; returns a HookResults otherwise.'
try:
return presubmit_support.DoPresubmitChecks(change, committing, verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin, default_presubmit=None, may_prompt=may... | 165,045,495,008,101,700 | Calls sys.exit() if the hook fails; returns a HookResults otherwise. | git_cl.py | RunHook | wuyong2k/chromium_depot_tool | python | def RunHook(self, committing, may_prompt, verbose, change):
try:
return presubmit_support.DoPresubmitChecks(change, committing, verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin, default_presubmit=None, may_prompt=may_prompt, rietveld_obj=self._codereview_impl.GetRieveldObjForPresubmit(... |
def CMDPatchIssue(self, issue_arg, reject, nocommit, directory):
'Fetches and applies the issue patch from codereview to local branch.'
if (isinstance(issue_arg, (int, long)) or issue_arg.isdigit()):
parsed_issue_arg = _ParsedIssueNumberArgument(int(issue_arg))
else:
parsed_issue_arg = self.... | 4,974,629,712,309,087,000 | Fetches and applies the issue patch from codereview to local branch. | git_cl.py | CMDPatchIssue | wuyong2k/chromium_depot_tool | python | def CMDPatchIssue(self, issue_arg, reject, nocommit, directory):
if (isinstance(issue_arg, (int, long)) or issue_arg.isdigit()):
parsed_issue_arg = _ParsedIssueNumberArgument(int(issue_arg))
else:
parsed_issue_arg = self._codereview_impl.ParseIssueURL(urlparse.urlparse(issue_arg))
if ((... |
def CMDUpload(self, options, git_diff_args, orig_args):
'Uploads a change to codereview.'
if git_diff_args:
base_branch = git_diff_args[0]
else:
if (self.GetBranch() is None):
DieWithError("Can't upload from detached HEAD state. Get on a branch!")
base_branch = self.GetCo... | -7,557,256,267,665,093,000 | Uploads a change to codereview. | git_cl.py | CMDUpload | wuyong2k/chromium_depot_tool | python | def CMDUpload(self, options, git_diff_args, orig_args):
if git_diff_args:
base_branch = git_diff_args[0]
else:
if (self.GetBranch() is None):
DieWithError("Can't upload from detached HEAD state. Get on a branch!")
base_branch = self.GetCommonAncestorWithUpstream()
... |
def SetCQState(self, new_state):
'Update the CQ state for latest patchset.\n\n Issue must have been already uploaded and known.\n '
assert (new_state in _CQState.ALL_STATES)
assert self.GetIssue()
return self._codereview_impl.SetCQState(new_state) | 4,467,814,156,745,606,000 | Update the CQ state for latest patchset.
Issue must have been already uploaded and known. | git_cl.py | SetCQState | wuyong2k/chromium_depot_tool | python | def SetCQState(self, new_state):
'Update the CQ state for latest patchset.\n\n Issue must have been already uploaded and known.\n '
assert (new_state in _CQState.ALL_STATES)
assert self.GetIssue()
return self._codereview_impl.SetCQState(new_state) |
def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or specific string keywords.\n "
raise NotImplementedError() | 6,329,365,881,695,162,000 | Apply a rough heuristic to give a simple summary of an issue's review
or CQ status, assuming adherence to a common workflow.
Returns None if no issue for this branch, or specific string keywords. | git_cl.py | GetStatus | wuyong2k/chromium_depot_tool | python | def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or specific string keywords.\n "
raise NotImplementedError() |
def GetCodereviewServer(self):
'Returns server URL without end slash, like "https://codereview.com".'
raise NotImplementedError() | -6,283,354,262,252,491,000 | Returns server URL without end slash, like "https://codereview.com". | git_cl.py | GetCodereviewServer | wuyong2k/chromium_depot_tool | python | def GetCodereviewServer(self):
raise NotImplementedError() |
def FetchDescription(self):
'Fetches and returns description from the codereview server.'
raise NotImplementedError() | 683,693,468,192,395,600 | Fetches and returns description from the codereview server. | git_cl.py | FetchDescription | wuyong2k/chromium_depot_tool | python | def FetchDescription(self):
raise NotImplementedError() |
def GetCodereviewServerSetting(self):
'Returns git config setting for the codereview server.'
raise NotImplementedError() | -8,951,700,844,428,134,000 | Returns git config setting for the codereview server. | git_cl.py | GetCodereviewServerSetting | wuyong2k/chromium_depot_tool | python | def GetCodereviewServerSetting(self):
raise NotImplementedError() |
@classmethod
def IssueSettingSuffix(cls):
'Returns name of git config setting which stores issue number for a given\n branch.'
raise NotImplementedError() | -7,071,520,134,023,710,000 | Returns name of git config setting which stores issue number for a given
branch. | git_cl.py | IssueSettingSuffix | wuyong2k/chromium_depot_tool | python | @classmethod
def IssueSettingSuffix(cls):
'Returns name of git config setting which stores issue number for a given\n branch.'
raise NotImplementedError() |
def PatchsetSetting(self):
'Returns name of git config setting which stores issue number.'
raise NotImplementedError() | -4,430,877,442,446,300,000 | Returns name of git config setting which stores issue number. | git_cl.py | PatchsetSetting | wuyong2k/chromium_depot_tool | python | def PatchsetSetting(self):
raise NotImplementedError() |
def _PostUnsetIssueProperties(self):
'Which branch-specific properties to erase when unsettin issue.'
raise NotImplementedError() | 4,685,999,962,814,047,000 | Which branch-specific properties to erase when unsettin issue. | git_cl.py | _PostUnsetIssueProperties | wuyong2k/chromium_depot_tool | python | def _PostUnsetIssueProperties(self):
raise NotImplementedError() |
def UpdateDescriptionRemote(self, description):
'Update the description on codereview site.'
raise NotImplementedError() | -7,340,033,275,796,108,000 | Update the description on codereview site. | git_cl.py | UpdateDescriptionRemote | wuyong2k/chromium_depot_tool | python | def UpdateDescriptionRemote(self, description):
raise NotImplementedError() |
def CloseIssue(self):
'Closes the issue.'
raise NotImplementedError() | -8,431,182,191,379,887,000 | Closes the issue. | git_cl.py | CloseIssue | wuyong2k/chromium_depot_tool | python | def CloseIssue(self):
raise NotImplementedError() |
def GetApprovingReviewers(self):
'Returns a list of reviewers approving the change.\n\n Note: not necessarily committers.\n '
raise NotImplementedError() | 2,777,351,221,320,171,000 | Returns a list of reviewers approving the change.
Note: not necessarily committers. | git_cl.py | GetApprovingReviewers | wuyong2k/chromium_depot_tool | python | def GetApprovingReviewers(self):
'Returns a list of reviewers approving the change.\n\n Note: not necessarily committers.\n '
raise NotImplementedError() |
def GetMostRecentPatchset(self):
'Returns the most recent patchset number from the codereview site.'
raise NotImplementedError() | -69,695,029,279,877,080 | Returns the most recent patchset number from the codereview site. | git_cl.py | GetMostRecentPatchset | wuyong2k/chromium_depot_tool | python | def GetMostRecentPatchset(self):
raise NotImplementedError() |
def CMDPatchWithParsedIssue(self, parsed_issue_arg, reject, nocommit, directory):
'Fetches and applies the issue.\n\n Arguments:\n parsed_issue_arg: instance of _ParsedIssueNumberArgument.\n reject: if True, reject the failed patch instead of switching to 3-way\n merge. Rietveld only.\n noc... | 1,090,445,375,256,550,700 | Fetches and applies the issue.
Arguments:
parsed_issue_arg: instance of _ParsedIssueNumberArgument.
reject: if True, reject the failed patch instead of switching to 3-way
merge. Rietveld only.
nocommit: do not commit the patch, thus leave the tree dirty. Rietveld
only.
directory: switch to directory be... | git_cl.py | CMDPatchWithParsedIssue | wuyong2k/chromium_depot_tool | python | def CMDPatchWithParsedIssue(self, parsed_issue_arg, reject, nocommit, directory):
'Fetches and applies the issue.\n\n Arguments:\n parsed_issue_arg: instance of _ParsedIssueNumberArgument.\n reject: if True, reject the failed patch instead of switching to 3-way\n merge. Rietveld only.\n noc... |
@staticmethod
def ParseIssueURL(parsed_url):
'Parses url and returns instance of _ParsedIssueNumberArgument or None if\n failed.'
raise NotImplementedError() | 3,797,609,221,604,850,000 | Parses url and returns instance of _ParsedIssueNumberArgument or None if
failed. | git_cl.py | ParseIssueURL | wuyong2k/chromium_depot_tool | python | @staticmethod
def ParseIssueURL(parsed_url):
'Parses url and returns instance of _ParsedIssueNumberArgument or None if\n failed.'
raise NotImplementedError() |
def EnsureAuthenticated(self, force):
'Best effort check that user is authenticated with codereview server.\n\n Arguments:\n force: whether to skip confirmation questions.\n '
raise NotImplementedError() | -8,503,028,676,478,826,000 | Best effort check that user is authenticated with codereview server.
Arguments:
force: whether to skip confirmation questions. | git_cl.py | EnsureAuthenticated | wuyong2k/chromium_depot_tool | python | def EnsureAuthenticated(self, force):
'Best effort check that user is authenticated with codereview server.\n\n Arguments:\n force: whether to skip confirmation questions.\n '
raise NotImplementedError() |
def CMDUploadChange(self, options, args, change):
'Uploads a change to codereview.'
raise NotImplementedError() | 8,035,336,178,282,116,000 | Uploads a change to codereview. | git_cl.py | CMDUploadChange | wuyong2k/chromium_depot_tool | python | def CMDUploadChange(self, options, args, change):
raise NotImplementedError() |
def SetCQState(self, new_state):
'Update the CQ state for latest patchset.\n\n Issue must have been already uploaded and known.\n '
raise NotImplementedError() | -6,356,504,941,651,309,000 | Update the CQ state for latest patchset.
Issue must have been already uploaded and known. | git_cl.py | SetCQState | wuyong2k/chromium_depot_tool | python | def SetCQState(self, new_state):
'Update the CQ state for latest patchset.\n\n Issue must have been already uploaded and known.\n '
raise NotImplementedError() |
def EnsureAuthenticated(self, force):
'Best effort check that user is authenticated with Rietveld server.'
if self._auth_config.use_oauth2:
authenticator = auth.get_authenticator_for_host(self.GetCodereviewServer(), self._auth_config)
if (not authenticator.has_cached_credentials()):
... | 8,550,876,920,952,164,000 | Best effort check that user is authenticated with Rietveld server. | git_cl.py | EnsureAuthenticated | wuyong2k/chromium_depot_tool | python | def EnsureAuthenticated(self, force):
if self._auth_config.use_oauth2:
authenticator = auth.get_authenticator_for_host(self.GetCodereviewServer(), self._auth_config)
if (not authenticator.has_cached_credentials()):
raise auth.LoginRequiredError(self.GetCodereviewServer()) |
def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or one of the following keywords:\n * 'error' - error from review tool (including deleted issues)\n * '... | -6,504,038,583,646,839,000 | Apply a rough heuristic to give a simple summary of an issue's review
or CQ status, assuming adherence to a common workflow.
Returns None if no issue for this branch, or one of the following keywords:
* 'error' - error from review tool (including deleted issues)
* 'unsent' - not sent for review
* 'waiting' - ... | git_cl.py | GetStatus | wuyong2k/chromium_depot_tool | python | def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or one of the following keywords:\n * 'error' - error from review tool (including deleted issues)\n * '... |
def SetFlag(self, flag, value):
'Patchset must match.'
if (not self.GetPatchset()):
DieWithError('The patchset needs to match. Send another patchset.')
try:
return self.RpcServer().set_flag(self.GetIssue(), self.GetPatchset(), flag, value)
except urllib2.HTTPError as e:
if (e.cod... | -2,922,904,480,073,585,700 | Patchset must match. | git_cl.py | SetFlag | wuyong2k/chromium_depot_tool | python | def SetFlag(self, flag, value):
if (not self.GetPatchset()):
DieWithError('The patchset needs to match. Send another patchset.')
try:
return self.RpcServer().set_flag(self.GetIssue(), self.GetPatchset(), flag, value)
except urllib2.HTTPError as e:
if (e.code == 404):
... |
def RpcServer(self):
"Returns an upload.RpcServer() to access this review's rietveld instance.\n "
if (not self._rpc_server):
self._rpc_server = rietveld.CachingRietveld(self.GetCodereviewServer(), (self._auth_config or auth.make_auth_config()))
return self._rpc_server | -5,865,990,408,082,371,000 | Returns an upload.RpcServer() to access this review's rietveld instance. | git_cl.py | RpcServer | wuyong2k/chromium_depot_tool | python | def RpcServer(self):
"\n "
if (not self._rpc_server):
self._rpc_server = rietveld.CachingRietveld(self.GetCodereviewServer(), (self._auth_config or auth.make_auth_config()))
return self._rpc_server |
def PatchsetSetting(self):
"Return the git setting that stores this change's most recent patchset."
return ('branch.%s.rietveldpatchset' % self.GetBranch()) | -8,972,197,271,422,346,000 | Return the git setting that stores this change's most recent patchset. | git_cl.py | PatchsetSetting | wuyong2k/chromium_depot_tool | python | def PatchsetSetting(self):
return ('branch.%s.rietveldpatchset' % self.GetBranch()) |
def GetCodereviewServerSetting(self):
"Returns the git setting that stores this change's rietveld server."
branch = self.GetBranch()
if branch:
return ('branch.%s.rietveldserver' % branch)
return None | -4,057,608,187,407,304,700 | Returns the git setting that stores this change's rietveld server. | git_cl.py | GetCodereviewServerSetting | wuyong2k/chromium_depot_tool | python | def GetCodereviewServerSetting(self):
branch = self.GetBranch()
if branch:
return ('branch.%s.rietveldserver' % branch)
return None |
def _PostUnsetIssueProperties(self):
'Which branch-specific properties to erase when unsetting issue.'
return ['rietveldserver'] | 6,426,913,963,738,132,000 | Which branch-specific properties to erase when unsetting issue. | git_cl.py | _PostUnsetIssueProperties | wuyong2k/chromium_depot_tool | python | def _PostUnsetIssueProperties(self):
return ['rietveldserver'] |
def CMDUploadChange(self, options, args, change):
'Upload the patch to Rietveld.'
upload_args = ['--assume_yes']
upload_args.extend(['--server', self.GetCodereviewServer()])
upload_args.extend(auth.auth_config_to_command_options(self._auth_config))
if options.emulate_svn_auto_props:
upload_a... | 4,221,466,073,041,626,600 | Upload the patch to Rietveld. | git_cl.py | CMDUploadChange | wuyong2k/chromium_depot_tool | python | def CMDUploadChange(self, options, args, change):
upload_args = ['--assume_yes']
upload_args.extend(['--server', self.GetCodereviewServer()])
upload_args.extend(auth.auth_config_to_command_options(self._auth_config))
if options.emulate_svn_auto_props:
upload_args.append('--emulate_svn_auto_... |
def _GetGitHost(self):
'Returns git host to be used when uploading change to Gerrit.'
return urlparse.urlparse(self.GetRemoteUrl()).netloc | -2,931,209,852,958,704,000 | Returns git host to be used when uploading change to Gerrit. | git_cl.py | _GetGitHost | wuyong2k/chromium_depot_tool | python | def _GetGitHost(self):
return urlparse.urlparse(self.GetRemoteUrl()).netloc |
def EnsureAuthenticated(self, force):
'Best effort check that user is authenticated with Gerrit server.'
if settings.GetGerritSkipEnsureAuthenticated():
return
if gerrit_util.GceAuthenticator.is_gce():
return
self.GetCodereviewServer()
git_host = self._GetGitHost()
assert (self._... | 2,260,168,958,560,955,000 | Best effort check that user is authenticated with Gerrit server. | git_cl.py | EnsureAuthenticated | wuyong2k/chromium_depot_tool | python | def EnsureAuthenticated(self, force):
if settings.GetGerritSkipEnsureAuthenticated():
return
if gerrit_util.GceAuthenticator.is_gce():
return
self.GetCodereviewServer()
git_host = self._GetGitHost()
assert (self._gerrit_server and self._gerrit_host)
cookie_auth = gerrit_util... |
def PatchsetSetting(self):
"Return the git setting that stores this change's most recent patchset."
return ('branch.%s.gerritpatchset' % self.GetBranch()) | 5,591,027,276,532,097,000 | Return the git setting that stores this change's most recent patchset. | git_cl.py | PatchsetSetting | wuyong2k/chromium_depot_tool | python | def PatchsetSetting(self):
return ('branch.%s.gerritpatchset' % self.GetBranch()) |
def GetCodereviewServerSetting(self):
"Returns the git setting that stores this change's Gerrit server."
branch = self.GetBranch()
if branch:
return ('branch.%s.gerritserver' % branch)
return None | 6,454,964,620,202,646,000 | Returns the git setting that stores this change's Gerrit server. | git_cl.py | GetCodereviewServerSetting | wuyong2k/chromium_depot_tool | python | def GetCodereviewServerSetting(self):
branch = self.GetBranch()
if branch:
return ('branch.%s.gerritserver' % branch)
return None |
def _PostUnsetIssueProperties(self):
'Which branch-specific properties to erase when unsetting issue.'
return ['gerritserver', 'gerritsquashhash'] | -7,306,721,975,579,348,000 | Which branch-specific properties to erase when unsetting issue. | git_cl.py | _PostUnsetIssueProperties | wuyong2k/chromium_depot_tool | python | def _PostUnsetIssueProperties(self):
return ['gerritserver', 'gerritsquashhash'] |
def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or one of the following keywords:\n * 'error' - error from review tool (including deleted issues)\n * ... | 3,784,288,564,603,652,000 | Apply a rough heuristic to give a simple summary of an issue's review
or CQ status, assuming adherence to a common workflow.
Returns None if no issue for this branch, or one of the following keywords:
* 'error' - error from review tool (including deleted issues)
* 'unsent' - no reviewers added
* 'waiting' ... | git_cl.py | GetStatus | wuyong2k/chromium_depot_tool | python | def GetStatus(self):
"Apply a rough heuristic to give a simple summary of an issue's review\n or CQ status, assuming adherence to a common workflow.\n\n Returns None if no issue for this branch, or one of the following keywords:\n * 'error' - error from review tool (including deleted issues)\n * ... |
def GetApprovingReviewers(self):
'Returns a list of reviewers approving the change.\n\n Note: not necessarily committers.\n '
raise NotImplementedError() | 2,777,351,221,320,171,000 | Returns a list of reviewers approving the change.
Note: not necessarily committers. | git_cl.py | GetApprovingReviewers | wuyong2k/chromium_depot_tool | python | def GetApprovingReviewers(self):
'Returns a list of reviewers approving the change.\n\n Note: not necessarily committers.\n '
raise NotImplementedError() |
def CMDUploadChange(self, options, args, change):
'Upload the current branch to Gerrit.'
if (options.squash and options.no_squash):
DieWithError('Can only use one of --squash or --no-squash')
if ((not options.squash) and (not options.no_squash)):
options.squash = settings.GetSquashGerritUplo... | 6,165,878,012,663,440,000 | Upload the current branch to Gerrit. | git_cl.py | CMDUploadChange | wuyong2k/chromium_depot_tool | python | def CMDUploadChange(self, options, args, change):
if (options.squash and options.no_squash):
DieWithError('Can only use one of --squash or --no-squash')
if ((not options.squash) and (not options.no_squash)):
options.squash = settings.GetSquashGerritUploads()
elif options.no_squash:
... |
def _AddChangeIdToCommitMessage(self, options, args):
'Re-commits using the current message, assumes the commit hook is in\n place.\n '
log_desc = (options.message or CreateDescriptionFromLog(args))
git_command = ['commit', '--amend', '-m', log_desc]
RunGit(git_command)
new_log_desc = CreateDe... | -2,375,211,046,930,508,000 | Re-commits using the current message, assumes the commit hook is in
place. | git_cl.py | _AddChangeIdToCommitMessage | wuyong2k/chromium_depot_tool | python | def _AddChangeIdToCommitMessage(self, options, args):
'Re-commits using the current message, assumes the commit hook is in\n place.\n '
log_desc = (options.message or CreateDescriptionFromLog(args))
git_command = ['commit', '--amend', '-m', log_desc]
RunGit(git_command)
new_log_desc = CreateDe... |
def SetCQState(self, new_state):
'Sets the Commit-Queue label assuming canonical CQ config for Gerrit.'
vote_map = {_CQState.NONE: 0, _CQState.DRY_RUN: 1, _CQState.COMMIT: 2}
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), labels={'Commit-Queue': vote_map[new_state]}) | -7,298,066,659,973,490,000 | Sets the Commit-Queue label assuming canonical CQ config for Gerrit. | git_cl.py | SetCQState | wuyong2k/chromium_depot_tool | python | def SetCQState(self, new_state):
vote_map = {_CQState.NONE: 0, _CQState.DRY_RUN: 1, _CQState.COMMIT: 2}
gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(), labels={'Commit-Queue': vote_map[new_state]}) |
def update_reviewers(self, reviewers, add_owners_tbr=False, change=None):
'Rewrites the R=/TBR= line(s) as a single line each.'
assert isinstance(reviewers, list), reviewers
if ((not reviewers) and (not add_owners_tbr)):
return
reviewers = reviewers[:]
regexp = re.compile(self.R_LINE)
ma... | -3,866,714,032,062,314,500 | Rewrites the R=/TBR= line(s) as a single line each. | git_cl.py | update_reviewers | wuyong2k/chromium_depot_tool | python | def update_reviewers(self, reviewers, add_owners_tbr=False, change=None):
assert isinstance(reviewers, list), reviewers
if ((not reviewers) and (not add_owners_tbr)):
return
reviewers = reviewers[:]
regexp = re.compile(self.R_LINE)
matches = [regexp.match(line) for line in self._descrip... |
def prompt(self):
'Asks the user to update the description.'
self.set_description((['# Enter a description of the change.', '# This will be displayed on the codereview site.', '# The first line will also be used as the subject of the review.', '#--------------------This line is 72 characters long---------------... | 6,837,271,194,655,891,000 | Asks the user to update the description. | git_cl.py | prompt | wuyong2k/chromium_depot_tool | python | def prompt(self):
self.set_description((['# Enter a description of the change.', '# This will be displayed on the codereview site.', '# The first line will also be used as the subject of the review.', '#--------------------This line is 72 characters long--------------------'] + self._description_lines))
re... |
def append_footer(self, line):
'Adds a footer line to the description.\n\n Differentiates legacy "KEY=xxx" footers (used to be called tags) and\n Gerrit\'s footers in the form of "Footer-Key: footer any value" and ensures\n that Gerrit footers are always at the end.\n '
parsed_footer_line = git_foot... | -4,948,696,434,904,024,000 | Adds a footer line to the description.
Differentiates legacy "KEY=xxx" footers (used to be called tags) and
Gerrit's footers in the form of "Footer-Key: footer any value" and ensures
that Gerrit footers are always at the end. | git_cl.py | append_footer | wuyong2k/chromium_depot_tool | python | def append_footer(self, line):
'Adds a footer line to the description.\n\n Differentiates legacy "KEY=xxx" footers (used to be called tags) and\n Gerrit\'s footers in the form of "Footer-Key: footer any value" and ensures\n that Gerrit footers are always at the end.\n '
parsed_footer_line = git_foot... |
def get_reviewers(self):
'Retrieves the list of reviewers.'
matches = [re.match(self.R_LINE, line) for line in self._description_lines]
reviewers = [match.group(2).strip() for match in matches if match]
return cleanup_list(reviewers) | 1,088,958,793,655,500,300 | Retrieves the list of reviewers. | git_cl.py | get_reviewers | wuyong2k/chromium_depot_tool | python | def get_reviewers(self):
matches = [re.match(self.R_LINE, line) for line in self._description_lines]
reviewers = [match.group(2).strip() for match in matches if match]
return cleanup_list(reviewers) |
def patch_tpool_proxy():
"eventlet.tpool.Proxy doesn't work with old-style class in __str__()\n or __repr__() calls. See bug #962840 for details.\n We perform a monkey patch to replace those two instance methods.\n "
def str_method(self):
return str(self._obj)
def repr_method(self):
... | -8,502,220,070,496,038,000 | eventlet.tpool.Proxy doesn't work with old-style class in __str__()
or __repr__() calls. See bug #962840 for details.
We perform a monkey patch to replace those two instance methods. | nova/virt/libvirt/driver.py | patch_tpool_proxy | srajag/nova | python | def patch_tpool_proxy():
"eventlet.tpool.Proxy doesn't work with old-style class in __str__()\n or __repr__() calls. See bug #962840 for details.\n We perform a monkey patch to replace those two instance methods.\n "
def str_method(self):
return str(self._obj)
def repr_method(self):
... |
def _set_cache_mode(self, conf):
'Set cache mode on LibvirtConfigGuestDisk object.'
try:
source_type = conf.source_type
driver_cache = conf.driver_cache
except AttributeError:
return
cache_mode = self.disk_cachemodes.get(source_type, driver_cache)
conf.driver_cache = cache_mo... | 5,531,731,997,377,213,000 | Set cache mode on LibvirtConfigGuestDisk object. | nova/virt/libvirt/driver.py | _set_cache_mode | srajag/nova | python | def _set_cache_mode(self, conf):
try:
source_type = conf.source_type
driver_cache = conf.driver_cache
except AttributeError:
return
cache_mode = self.disk_cachemodes.get(source_type, driver_cache)
conf.driver_cache = cache_mode |
def _native_thread(self):
"Receives async events coming in from libvirtd.\n\n This is a native thread which runs the default\n libvirt event loop implementation. This processes\n any incoming async events from libvirtd and queues\n them for later dispatch. This thread is only\n pe... | 7,655,609,895,301,288,000 | Receives async events coming in from libvirtd.
This is a native thread which runs the default
libvirt event loop implementation. This processes
any incoming async events from libvirtd and queues
them for later dispatch. This thread is only
permitted to use libvirt python APIs, and the
driver.queue_event method. In par... | nova/virt/libvirt/driver.py | _native_thread | srajag/nova | python | def _native_thread(self):
"Receives async events coming in from libvirtd.\n\n This is a native thread which runs the default\n libvirt event loop implementation. This processes\n any incoming async events from libvirtd and queues\n them for later dispatch. This thread is only\n pe... |
def _dispatch_thread(self):
'Dispatches async events coming in from libvirtd.\n\n This is a green thread which waits for events to\n arrive from the libvirt event loop thread. This\n then dispatches the events to the compute manager.\n '
while True:
self._dispatch_events() | 6,173,909,251,682,045,000 | Dispatches async events coming in from libvirtd.
This is a green thread which waits for events to
arrive from the libvirt event loop thread. This
then dispatches the events to the compute manager. | nova/virt/libvirt/driver.py | _dispatch_thread | srajag/nova | python | def _dispatch_thread(self):
'Dispatches async events coming in from libvirtd.\n\n This is a green thread which waits for events to\n arrive from the libvirt event loop thread. This\n then dispatches the events to the compute manager.\n '
while True:
self._dispatch_events() |
@staticmethod
def _event_lifecycle_callback(conn, dom, event, detail, opaque):
'Receives lifecycle events from libvirt.\n\n NB: this method is executing in a native thread, not\n an eventlet coroutine. It can only invoke other libvirt\n APIs, or use self.queue_event(). Any use of logging APIs\n... | 9,154,323,491,274,748,000 | Receives lifecycle events from libvirt.
NB: this method is executing in a native thread, not
an eventlet coroutine. It can only invoke other libvirt
APIs, or use self.queue_event(). Any use of logging APIs
in particular is forbidden. | nova/virt/libvirt/driver.py | _event_lifecycle_callback | srajag/nova | python | @staticmethod
def _event_lifecycle_callback(conn, dom, event, detail, opaque):
'Receives lifecycle events from libvirt.\n\n NB: this method is executing in a native thread, not\n an eventlet coroutine. It can only invoke other libvirt\n APIs, or use self.queue_event(). Any use of logging APIs\n... |
def _queue_event(self, event):
'Puts an event on the queue for dispatch.\n\n This method is called by the native event thread to\n put events on the queue for later dispatch by the\n green thread. Any use of logging APIs is forbidden.\n '
if (self._event_queue is None):
retur... | 5,110,817,474,055,161,000 | Puts an event on the queue for dispatch.
This method is called by the native event thread to
put events on the queue for later dispatch by the
green thread. Any use of logging APIs is forbidden. | nova/virt/libvirt/driver.py | _queue_event | srajag/nova | python | def _queue_event(self, event):
'Puts an event on the queue for dispatch.\n\n This method is called by the native event thread to\n put events on the queue for later dispatch by the\n green thread. Any use of logging APIs is forbidden.\n '
if (self._event_queue is None):
retur... |
def _dispatch_events(self):
'Wait for & dispatch events from native thread\n\n Blocks until native thread indicates some events\n are ready. Then dispatches all queued events.\n '
try:
_c = self._event_notify_recv.read(1)
assert _c
except ValueError:
return
l... | -360,219,353,666,080,640 | Wait for & dispatch events from native thread
Blocks until native thread indicates some events
are ready. Then dispatches all queued events. | nova/virt/libvirt/driver.py | _dispatch_events | srajag/nova | python | def _dispatch_events(self):
'Wait for & dispatch events from native thread\n\n Blocks until native thread indicates some events\n are ready. Then dispatches all queued events.\n '
try:
_c = self._event_notify_recv.read(1)
assert _c
except ValueError:
return
l... |
def _init_events_pipe(self):
'Create a self-pipe for the native thread to synchronize on.\n\n This code is taken from the eventlet tpool module, under terms\n of the Apache License v2.0.\n '
self._event_queue = native_Queue.Queue()
try:
(rpipe, wpipe) = os.pipe()
self._e... | -7,875,527,013,368,604,000 | Create a self-pipe for the native thread to synchronize on.
This code is taken from the eventlet tpool module, under terms
of the Apache License v2.0. | nova/virt/libvirt/driver.py | _init_events_pipe | srajag/nova | python | def _init_events_pipe(self):
'Create a self-pipe for the native thread to synchronize on.\n\n This code is taken from the eventlet tpool module, under terms\n of the Apache License v2.0.\n '
self._event_queue = native_Queue.Queue()
try:
(rpipe, wpipe) = os.pipe()
self._e... |
def _init_events(self):
'Initializes the libvirt events subsystem.\n\n This requires running a native thread to provide the\n libvirt event loop integration. This forwards events\n to a green thread which does the actual dispatching.\n '
self._init_events_pipe()
LOG.debug('Starti... | 1,019,574,824,169,468,700 | Initializes the libvirt events subsystem.
This requires running a native thread to provide the
libvirt event loop integration. This forwards events
to a green thread which does the actual dispatching. | nova/virt/libvirt/driver.py | _init_events | srajag/nova | python | def _init_events(self):
'Initializes the libvirt events subsystem.\n\n This requires running a native thread to provide the\n libvirt event loop integration. This forwards events\n to a green thread which does the actual dispatching.\n '
self._init_events_pipe()
LOG.debug('Starti... |
def _do_quality_warnings(self):
'Warn about untested driver configurations.\n\n This will log a warning message about untested driver or host arch\n configurations to indicate to administrators that the quality is\n unknown. Currently, only qemu or kvm on intel 32- or 64-bit systems\n is... | 920,347,697,261,030,000 | Warn about untested driver configurations.
This will log a warning message about untested driver or host arch
configurations to indicate to administrators that the quality is
unknown. Currently, only qemu or kvm on intel 32- or 64-bit systems
is tested upstream. | nova/virt/libvirt/driver.py | _do_quality_warnings | srajag/nova | python | def _do_quality_warnings(self):
'Warn about untested driver configurations.\n\n This will log a warning message about untested driver or host arch\n configurations to indicate to administrators that the quality is\n unknown. Currently, only qemu or kvm on intel 32- or 64-bit systems\n is... |
def instance_exists(self, instance):
'Efficient override of base instance_exists method.'
try:
self._lookup_by_name(instance.name)
return True
except exception.NovaException:
return False | 4,235,376,044,896,723,500 | Efficient override of base instance_exists method. | nova/virt/libvirt/driver.py | instance_exists | srajag/nova | python | def instance_exists(self, instance):
try:
self._lookup_by_name(instance.name)
return True
except exception.NovaException:
return False |
def _list_instance_domains(self, only_running=True, only_guests=True):
'Get a list of libvirt.Domain objects for nova instances\n\n :param only_running: True to only return running instances\n :param only_guests: True to filter out any host domain (eg Dom-0)\n\n Query libvirt to a get a list of... | -8,610,953,524,653,425,000 | Get a list of libvirt.Domain objects for nova instances
:param only_running: True to only return running instances
:param only_guests: True to filter out any host domain (eg Dom-0)
Query libvirt to a get a list of all libvirt.Domain objects
that correspond to nova instances. If the only_running parameter
is true this... | nova/virt/libvirt/driver.py | _list_instance_domains | srajag/nova | python | def _list_instance_domains(self, only_running=True, only_guests=True):
'Get a list of libvirt.Domain objects for nova instances\n\n :param only_running: True to only return running instances\n :param only_guests: True to filter out any host domain (eg Dom-0)\n\n Query libvirt to a get a list of... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.