Lines Matching refs:ui
280 def Flush(self, ui, repo): argument
282 self.Upload(ui, repo, gofmt_just_warn=True, creating=True)
283 dir = CodeReviewDir(ui, repo)
296 def Delete(self, ui, repo): argument
297 dir = CodeReviewDir(ui, repo)
309 …def Upload(self, ui, repo, send_mail=False, gofmt=True, gofmt_just_warn=False, creating=False, qui… argument
311 ui.warn("no files in change list\n")
312 if ui.configbool("codereview", "force_gofmt", True) and gofmt:
313 CheckFormat(ui, repo, self.files, just_warn=gofmt_just_warn)
336 vcs = MercurialVCS(upload_options, ui, repo)
348 form_fields.append(("subject", "diff -r " + vcs.base_rev + " " + ui.expandpath("default")))
364 ui.status(msg + "\n")
383 self.Flush(ui, repo)
386 def Mail(self, ui, repo): argument
392 repourl = ui.expandpath("default")
398 PostMessage(ui, self.name, pmsg, subject=self.Subject())
400 self.Flush(ui, repo)
502 def IsLocalCL(ui, repo, name): argument
503 return GoodCLName(name) and os.access(CodeReviewDir(ui, repo) + "/cl." + name, 0)
506 def LoadCL(ui, repo, name, web=True): argument
511 dir = CodeReviewDir(ui, repo)
525 d = JSONGet(ui, "/api/" + name + "?messages=true")
556 def __init__(self, ui, repo, dir, f, web): argument
558 self.ui = ui
565 cl, err = LoadCL(self.ui, self.repo, self.f[3:], web=self.web)
567 self.ui.warn("loading "+self.dir+self.f+": " + err + "\n")
572 def LoadAllCL(ui, repo, web=True): argument
573 dir = CodeReviewDir(ui, repo)
581 t = LoadCLThread(ui, repo, dir, f, web)
600 def RepoDir(ui, repo): argument
603 ui.warn("repository %s is not in local file system\n" % (url,))
612 def CodeReviewDir(ui, repo): argument
613 dir = RepoDir(ui, repo)
621 ui.warn('cannot mkdir %s: %s\n' % (dir, ExceptionDetail()))
713 def promptyesno(ui, msg): argument
714 return ui.promptchoice(msg, ["&yes", "&no"], 0) == 0
716 def promptremove(ui, repo, f): argument
717 if promptyesno(ui, "hg remove %s (y/n)?" % (f,)):
718 if hg_commands.remove(ui, repo, 'path:'+f) != 0:
719 ui.warn("error removing %s" % (f,))
721 def promptadd(ui, repo, f): argument
722 if promptyesno(ui, "hg add %s (y/n)?" % (f,)):
723 if hg_commands.add(ui, repo, 'path:'+f) != 0:
724 ui.warn("error adding %s" % (f,))
726 def EditCL(ui, repo, cl): argument
730 s = ui.edit(s, ui.username())
745 if not promptyesno(ui, "error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err)):
751 if promptyesno(ui, "change list should have a description\nre-edit (y/n)?"):
754 if promptyesno(ui, "change list description omits reason for undo\nre-edit (y/n)?"):
757 if promptyesno(ui, desc_msg + "re-edit (y/n)?"):
763 changed = hg_matchPattern(ui, repo, *pats, modified=True, added=True, removed=True)
764 deleted = hg_matchPattern(ui, repo, *pats, deleted=True)
765 unknown = hg_matchPattern(ui, repo, *pats, unknown=True)
766 ignored = hg_matchPattern(ui, repo, *pats, ignored=True)
767 clean = hg_matchPattern(ui, repo, *pats, clean=True)
774 promptremove(ui, repo, f)
778 promptadd(ui, repo, f)
782 ui.warn("error: %s is excluded by .hgignore; omitting\n" % (f,))
785 ui.warn("warning: %s is listed in the CL but unchanged\n" % (f,))
790 ui.warn("warning: %s is a file but not known to hg\n" % (f,))
794 ui.warn("error: %s is a directory, not a file; omitting\n" % (f,))
796 ui.warn("error: %s does not exist; omitting\n" % (f,))
810 def CommandLineCL(ui, repo, pats, opts, defaultcc=None): argument
816 cl, err = LoadCL(ui, repo, pats[0], web=True)
822 cl.files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
835 err = EditCL(ui, repo, cl)
846 def ChangedFiles(ui, repo, pats, taken=None): argument
851 for f in hg_matchPattern(ui, repo, p, unknown=True):
852 promptadd(ui, repo, f)
853 for f in hg_matchPattern(ui, repo, p, removed=True):
854 promptremove(ui, repo, f)
855 files = hg_matchPattern(ui, repo, p, modified=True, added=True, removed=True)
858 ui.warn("warning: %s already in CL %s\n" % (f, taken[f].name))
860 ui.warn("warning: %s did not match any modified files\n" % (p,))
863 l = hg_matchPattern(ui, repo, *pats, modified=True, added=True, removed=True)
870 def ChangedExistingFiles(ui, repo, pats, opts): argument
871 l = hg_matchPattern(ui, repo, *pats, modified=True, added=True)
876 def Taken(ui, repo): argument
877 all = LoadAllCL(ui, repo, web=False)
885 def DefaultFiles(ui, repo, pats): argument
886 return ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
891 def CheckFormat(ui, repo, files, just_warn=False): argument
893 CheckGofmt(ui, repo, files, just_warn)
894 CheckTabfmt(ui, repo, files, just_warn)
897 def CheckGofmt(ui, repo, files, just_warn): argument
916 ui.warn("gofmt errors:\n" + errors.rstrip() + "\n")
921 ui.warn("warning: " + msg + "\n")
927 def CheckTabfmt(ui, repo, files, just_warn): argument
950 ui.warn("warning: " + msg + "\n")
961 def ReadContributors(ui, repo): argument
974 ui.write("warning: cannot open %s: %s\n" % (opening, ExceptionDetail()))
996 def CheckContributor(ui, repo, user=None): argument
998 user, userline = FindContributor(ui, repo, user, warn=False)
1003 def FindContributor(ui, repo, user=None, warn=True): argument
1005 user = ui.config("ui", "username")
1013 contributors = ReadContributors(ui, repo)
1016 ui.warn("warning: cannot find %s in CONTRIBUTORS\n" % (user,))
1069 def __init__(self, ui): argument
1070 self.ui = ui
1071 ui.pushbuffer()
1072 self.oldQuiet = ui.quiet
1073 ui.quiet = True
1074 self.oldVerbose = ui.verbose
1075 ui.verbose = False
1077 ui = self.ui
1078 ui.quiet = self.oldQuiet
1079 ui.verbose = self.oldVerbose
1080 return ui.popbuffer()
1087 def hg_matchPattern(ui, repo, *pats, **opts): argument
1088 w = uiwrap(ui)
1089 hg_commands.status(ui, repo, *pats, **opts)
1108 def hg_heads(ui, repo): argument
1109 w = uiwrap(ui)
1110 hg_commands.heads(ui, repo)
1131 def hg_incoming(ui, repo): argument
1132 w = uiwrap(ui)
1133 ret = hg_commands.incoming(ui, repo, force=False, bundle="")
1138 def hg_log(ui, repo, **opts): argument
1142 w = uiwrap(ui)
1143 ret = hg_commands.log(ui, repo, **opts)
1148 def hg_outgoing(ui, repo, **opts): argument
1149 w = uiwrap(ui)
1150 ret = hg_commands.outgoing(ui, repo, **opts)
1155 def hg_pull(ui, repo, **opts): argument
1156 w = uiwrap(ui)
1157 ui.quiet = False
1158 ui.verbose = True # for file list
1159 err = hg_commands.pull(ui, repo, **opts)
1171 ui.write(line + '\n')
1174 def hg_push(ui, repo, **opts): argument
1175 w = uiwrap(ui)
1176 ui.quiet = False
1177 ui.verbose = True
1178 err = hg_commands.push(ui, repo, **opts)
1181 ui.write(line + '\n')
1184 def hg_commit(ui, repo, *pats, **opts): argument
1185 return hg_commands.commit(ui, repo, *pats, **opts)
1192 def precommithook(ui, repo, **opts): argument
1195 ui.write("\ncodereview extension enabled; use mail, upload, or submit instead of commit\n\n")
1207 def InstallMatch(ui, repo): argument
1212 match_ui = ui
1234 cl, err = LoadCL(match_repo.ui, match_repo, clname, web=False)
1259 def wrapped(ui, repo, *pats, **opts): argument
1260 err = f(ui, repo, *pats, **opts)
1273 def change(ui, repo, *pats, **opts): argument
1304 cl, err = LoadCL(ui, repo, name, web=True)
1315 files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
1332 PostMessage(ui, cl.name, "*** Abandoned ***", send_mail=cl.mailed)
1334 cl.Delete(ui, repo)
1361 err = EditCL(ui, repo, cl)
1368 d.Flush(ui, repo)
1370 d.Upload(ui, repo, quiet=True)
1373 ui.write(cl.EditorText())
1375 ui.write(cl.PendingText())
1377 if ui.quiet:
1378 ui.write(cl.name)
1380 ui.write("CL created: " + cl.url + "\n")
1387 def code_login(ui, repo, **opts): argument
1403 def clpatch(ui, repo, clname, **opts): argument
1415 return clpatch_or_undo(ui, repo, clname, opts, mode="clpatch")
1418 def undo(ui, repo, clname, **opts): argument
1427 return clpatch_or_undo(ui, repo, clname, opts, mode="undo")
1430 def release_apply(ui, repo, clname, **opts): argument
1479 err = clpatch_or_undo(ui, repo, clname, opts, mode="backport")
1517 def clpatch_or_undo(ui, repo, clname, opts, mode): argument
1530 …for r in hg_log(ui, repo, keyword="codereview.appspot.com/"+clname, limit=100, template="{node}\n"…
1566 cl, vers, patch, err = DownloadCL(ui, repo, clname)
1608 files = ChangedFiles(ui, repo, [])
1611 …ui.warn("warning: these files were listed in the patch but not changed:\n\t" + "\n\t".join(extra) …
1612 cl.Flush(ui, repo)
1614 err = EditCL(ui, repo, cl)
1617 cl.Flush(ui, repo)
1619 ui.write(cl.PendingText() + "\n")
1683 def download(ui, repo, clname, **opts): argument
1692 cl, vers, patch, err = DownloadCL(ui, repo, clname)
1695 ui.write(cl.EditorText() + "\n")
1696 ui.write(patch + "\n")
1703 def file(ui, repo, clname, pat, *pats, **opts): argument
1719 cl, err = LoadCL(ui, repo, clname, web=False)
1725 files = ChangedFiles(ui, repo, pats)
1730 if not ui.quiet:
1731 ui.status("# Removing files from CL. To undo:\n")
1732 ui.status("# cd %s\n" % (repo.root))
1734 ui.status("# hg file %s %s\n" % (cl.name, f))
1736 cl.Flush(ui, repo)
1738 ui.status("no such files in CL")
1745 taken = Taken(ui, repo)
1749 if not warned and not ui.quiet:
1750 ui.status("# Taking files from other CLs. To undo:\n")
1751 ui.status("# cd %s\n" % (repo.root))
1754 if not ui.quiet:
1755 ui.status("# hg file %s %s\n" % (ocl.name, f))
1762 d.Flush(ui, repo)
1769 def gofmt(ui, repo, *pats, **opts): argument
1778 files = ChangedExistingFiles(ui, repo, pats, opts)
1803 def mail(ui, repo, *pats, **opts): argument
1812 cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
1815 cl.Upload(ui, repo, gofmt_just_warn=True)
1825 cl.Flush(ui, repo)
1830 cl.Mail(ui, repo)
1836 def ps(ui, repo, *pats, **opts): argument
1840 return pending(ui, repo, *pats, **opts)
1843 def pq(ui, repo, *pats, **opts): argument
1847 return pending(ui, repo, *pats, **opts)
1850 def pending(ui, repo, *pats, **opts): argument
1860 m = LoadAllCL(ui, repo, web=not quick and not short)
1866 ui.write(name + "\t" + line1(cl.desc) + "\n")
1868 ui.write(cl.PendingText(quick=quick) + "\n")
1872 files = DefaultFiles(ui, repo, [])
1877 ui.write(s)
1886 def submit(ui, repo, *pats, **opts): argument
1898 if not opts["no_incoming"] and hg_incoming(ui, repo):
1901 cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
1908 userline = CheckContributor(ui, repo, user)
1929 cl.Upload(ui, repo, gofmt_just_warn=True)
1932 cl.Flush(ui, repo)
1933 CheckFormat(ui, repo, cl.files)
1938 about += "\nCommitter: " + CheckContributor(ui, repo, None) + "\n"
1942 cl.Mail(ui, repo)
1950 if hg_outgoing(ui, repo):
1953 old_heads = len(hg_heads(ui, repo).split())
1957 ret = hg_commit(ui, repo, *['path:'+f for f in cl.files], message=message, user=userline)
1964 new_heads = len(hg_heads(ui, repo).split())
1971 hg_push(ui, repo)
1983 url = ui.expandpath("default")
2001 PostMessage(ui, cl.name, pmsg, reviewers="", cc=JoinComma(cl.reviewer+cl.cc))
2005 cl.Delete(ui, repo)
2009 ui.write("switching from %s to default branch.\n" % releaseBranch)
2019 def sync(ui, repo, **opts): argument
2029 err = hg_pull(ui, repo, update=True)
2032 sync_changes(ui, repo)
2034 def sync_changes(ui, repo): argument
2038 for rev in hg_log(ui, repo, limit=100, template="{node}\n").split():
2041 if IsLocalCL(ui, repo, clname) and IsRietveldSubmitted(ui, clname, repo[rev].hex()):
2042 ui.warn("CL %s submitted as %s; closing\n" % (clname, repo[rev]))
2043 cl, err = LoadCL(ui, repo, clname, web=False)
2045 ui.warn("loading CL %s: %s\n" % (clname, err))
2049 cl.Delete(ui, repo)
2052 all = LoadAllCL(ui, repo, web=False)
2053 changed = ChangedFiles(ui, repo, [])
2057 ui.warn("Removing unmodified files from CL %s:\n" % (cl.name,))
2059 ui.warn("\t%s\n" % (f,))
2061 cl.Flush(ui, repo)
2064 ui.warn("CL %s has no files; delete (abandon) with hg change -d %s\n" % (cl.name, cl.name))
2066 ui.warn("CL %s has no files; delete locally with hg change -D %s\n" % (cl.name, cl.name))
2073 def upload(ui, repo, name, **opts): argument
2081 repo.ui.quiet = True
2082 cl, err = LoadCL(ui, repo, name, web=True)
2087 cl.Upload(ui, repo)
2221 def reposetup(ui, repo): argument
2261 remote = ui.config("paths", "default", "")
2265 InstallMatch(ui, repo)
2266 RietveldSetup(ui, repo)
2270 ui.setconfig("hooks", "precommit.codereview", precommithook)
2326 def JSONGet(ui, path): argument
2332 ui.warn("JSONGet %s: %s\n" % (path, ExceptionDetail()))
2363 def IsRietveldSubmitted(ui, clname, hex): argument
2364 dict = JSONGet(ui, "/api/" + clname + "?messages=true")
2380 def DownloadCL(ui, repo, clname): argument
2382 cl, err = LoadCL(ui, repo, clname, web=True)
2392 patchset = JSONGet(ui, "/api/" + clname + "/" + str(patchid))
2410 him = FindContributor(ui, repo, email)
2411 me = FindContributor(ui, repo, None)
2533 def PostMessage(ui, issue, message, reviewers=None, cc=None, send_mail=True, subject=None): argument
2561 def RietveldSetup(ui, repo): argument
2569 if not ui.verbose:
2573 x = ui.config("codereview", "server")
2579 x = ui.config("codereview", "email")
2585 testing = ui.config("codereview", "testing")
2586 force_google_account = ui.configbool("codereview", "force_google_account", False)
3365 def __init__(self, options, ui, repo): argument
3367 self.ui = ui