Lines Matching defs:CL
139 # CL description or author field, no matter how many conversions
189 # Change lists are stored in .hg/codereview/cl.nnnnnn
193 # The only thing in the cl.nnnnnn file is the list of relevant files.
194 # Also, the existence of the cl.nnnnnn file marks this repository
203 class CL(object):
220 cl = self
222 if cl.copied_from:
223 s += "Author: " + cl.copied_from + "\n\n"
224 if cl.private:
228 s += Indent(cl.desc, "\t")
230 for f in cl.files:
236 cl = self
239 if cl.copied_from:
240 s += "Author: " + cl.copied_from + "\n"
241 if cl.url != '':
242 s += 'URL: ' + cl.url + ' # cannot edit\n\n'
243 if cl.private:
245 s += "Reviewer: " + JoinComma(cl.reviewer) + "\n"
246 s += "CC: " + JoinComma(cl.cc) + "\n"
249 if cl.desc == '':
252 s += Indent(cl.desc, "\t")
254 if cl.local or cl.name == "new":
256 for f in cl.files:
263 cl = self
264 s = cl.name + ":" + "\n"
265 s += Indent(cl.desc, "\t")
267 if cl.copied_from:
268 s += "\tAuthor: " + cl.copied_from + "\n"
270 s += "\tReviewer: " + JoinComma(cl.reviewer) + "\n"
271 for (who, line) in cl.lgtm:
273 s += "\tCC: " + JoinComma(cl.cc) + "\n"
275 for f in cl.files:
284 path = dir + '/cl.' + self.name
298 os.unlink(dir + "/cl." + self.name)
314 set_status("uploading CL metadata + diffs")
332 # new CL's overall subject. So omit the diffs when creating
334 # This has the effect that every CL begins with an empty "Patch set 1".
350 # First upload sets the subject for the CL itself.
365 set_status("uploaded CL metadata + diffs")
445 cl = CL(name)
447 cl.copied_from = sections['Author']
448 cl.desc = sections['Description']
456 cl.files.append(line)
457 cl.reviewer = SplitCommaSpace(sections['Reviewer'])
458 cl.cc = SplitCommaSpace(sections['CC'])
459 cl.url = sections['URL']
465 cl.mailed = True
467 cl.private = True
468 if cl.desc == '<enter description here>':
469 cl.desc = ''
470 return cl, 0, ''
503 return GoodCLName(name) and os.access(CodeReviewDir(ui, repo) + "/cl." + name, 0)
505 # Load CL from disk and/or the web.
508 set_status("loading CL " + name)
510 return None, "invalid CL name"
512 path = dir + "cl." + name
517 cl, lineno, err = ParseCL(text, name)
519 return None, "malformed CL data: "+err
520 cl.local = True
522 cl = CL(name)
528 return None, "cannot load CL %s from server" % (name,)
530 return None, "malformed response loading CL data from code review server"
531 cl.dict = d
532 cl.reviewer = d.get('reviewers', [])
533 cl.cc = d.get('cc', [])
534 if cl.local and cl.copied_from and cl.desc:
535 # local copy of CL written by someone else
541 cl.desc = d.get('description', "")
542 cl.url = server_url_base + name
543 cl.web = True
544 cl.private = d.get('private', False) != False
545 cl.lgtm = []
550 cl.lgtm.append((who, text))
552 set_status("loaded CL " + name)
553 return cl, ''
563 self.cl = None
565 cl, err = LoadCL(self.ui, self.repo, self.f[3:], web=self.web)
569 self.cl = cl
575 files = [f for f in os.listdir(dir) if f.startswith('cl.')]
588 if t.cl:
589 m[t.cl.name] = t.cl
595 if t.cl:
596 m[t.cl.name] = t.cl
692 desc_re = '^(.+: |(tag )?(release|weekly)\.|fix build|undo CL)'
694 desc_msg = '''Your CL description appears not to use the standard form.
726 def EditCL(ui, repo, cl):
728 s = cl.EditorText()
733 # so, by popular demand, just scribble the most recent CL edit into
743 clx, line, err = ParseCL(s, cl.name)
785 ui.warn("warning: %s is listed in the CL but unchanged\n" % (f,))
799 cl.desc = clx.desc
800 cl.reviewer = clx.reviewer
801 cl.cc = clx.cc
802 cl.files = clx.files
803 cl.private = clx.private
815 return None, "cannot use -m with existing CL"
816 cl, err = LoadCL(ui, repo, pats[0], web=True)
820 cl = CL("new")
821 cl.local = True
822 cl.files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
823 if not cl.files:
826 cl.reviewer = Add(cl.reviewer, SplitCommaSpace(opts.get('reviewer')))
828 cl.cc = Add(cl.cc, SplitCommaSpace(opts.get('cc')))
830 cl.cc = Add(cl.cc, defaultcc)
831 if cl.name == "new":
833 cl.desc = opts.get('message')
835 err = EditCL(ui, repo, cl)
838 return cl, ""
858 ui.warn("warning: %s already in CL %s\n" % (f, taken[f].name))
879 for _, cl in all.items():
880 for f in cl.files:
881 taken[f] = cl
1233 raise hg_util.Abort("invalid CL name " + clname)
1234 cl, err = LoadCL(match_repo.ui, match_repo, clname, web=False)
1236 raise hg_util.Abort("loading CL " + clname + ": " + err)
1237 if not cl.files:
1238 raise hg_util.Abort("no files in CL " + clname)
1239 files = Add(files, cl.files)
1302 return "cannot specify CL name and file patterns"
1304 cl, err = LoadCL(ui, repo, name, web=True)
1307 if not cl.local and (opts["stdin"] or not opts["stdout"]):
1308 return "cannot change non-local CL " + name
1311 cl = CL("new")
1313 return "cannot create CL outside default branch; switch with 'hg update default'"
1314 dirty[cl] = True
1327 if not cl.local:
1328 return "cannot change non-local CL " + name
1330 if cl.copied_from:
1331 return "original author must delete CL; hg change -D will remove locally"
1332 PostMessage(ui, cl.name, "*** Abandoned ***", send_mail=cl.mailed)
1333 EditDesc(cl.name, closed=True, private=cl.private)
1334 cl.Delete(ui, repo)
1343 cl.desc = clx.desc;
1344 dirty[cl] = True
1346 cl.reviewer = clx.reviewer
1347 dirty[cl] = True
1349 cl.cc = clx.cc
1350 dirty[cl] = True
1352 cl.files = clx.files
1353 dirty[cl] = True
1354 if clx.private != cl.private:
1355 cl.private = clx.private
1356 dirty[cl] = True
1360 cl.files = files
1361 err = EditCL(ui, repo, cl)
1364 dirty[cl] = True
1373 ui.write(cl.EditorText())
1375 ui.write(cl.PendingText())
1378 ui.write(cl.name)
1380 ui.write("CL created: " + cl.url + "\n")
1419 """undo the effect of a CL
1421 Creates a new CL that undoes an earlier CL.
1422 After creating the CL, opens the CL text for editing so that
1431 """apply a CL to the release branch
1433 Creates a new CL copying a previously committed change
1488 # Extract CL name from revision description.
1496 undoHeader = """undo CL %s / %s
1500 ллл original CL description
1509 ллл CL %s / %s
1523 # Assume CL number is 7+ decimal digits.
1533 # Earlier ones might be part of the CL description.
1539 return "cannot find CL %s in local repository" % clname
1546 return "cannot find CL name in revision description"
1548 # Create fresh CL and start with patch that would reverse the change.
1550 cl = CL("new")
1553 cl.desc = (undoHeader % (clname, vers)) + desc + undoFooter
1555 cl.desc = (backportHeader % (releaseBranch, line1(desc), clname, vers)) + desc + undoFooter
1566 cl, vers, patch, err = DownloadCL(ui, repo, clname)
1604 cl.local = True
1605 cl.files = out.strip().split()
1606 if not cl.files and not opts["ignore_hgpatch_failure"]:
1609 extra = Sub(cl.files, files)
1612 cl.Flush(ui, repo)
1614 err = EditCL(ui, repo, cl)
1616 return "CL created, but error editing: " + err
1617 cl.Flush(ui, repo)
1619 ui.write(cl.PendingText() + "\n")
1692 cl, vers, patch, err = DownloadCL(ui, repo, clname)
1695 ui.write(cl.EditorText() + "\n")
1716 return "invalid CL name " + clname
1719 cl, err = LoadCL(ui, repo, clname, web=False)
1722 if not cl.local:
1723 return "cannot change non-local CL " + clname
1728 oldfiles = Intersect(files, cl.files)
1731 ui.status("# Removing files from CL. To undo:\n")
1734 ui.status("# hg file %s %s\n" % (cl.name, f))
1735 cl.files = Sub(cl.files, oldfiles)
1736 cl.Flush(ui, repo)
1738 ui.status("no such files in CL")
1744 files = Sub(files, cl.files)
1759 cl.files = Add(cl.files, files)
1760 dirty[cl] = True
1812 cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
1815 cl.Upload(ui, repo, gofmt_just_warn=True)
1816 if not cl.reviewer:
1822 return "no reviewers listed in CL"
1823 cl.cc = Sub(cl.cc, defaultcc)
1824 cl.reviewer = defaultcc
1825 cl.Flush(ui, repo)
1827 if cl.files == []:
1830 cl.Mail(ui, repo)
1864 cl = m[name]
1866 ui.write(name + "\t" + line1(cl.desc) + "\n")
1868 ui.write(cl.PendingText(quick=quick) + "\n")
1874 s = "Changed files not in any CL:\n"
1901 cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
1906 if cl.copied_from:
1907 user = cl.copied_from
1912 if cl.reviewer:
1913 about += "R=" + JoinComma([CutDomain(s) for s in cl.reviewer]) + "\n"
1916 cl.reviewer = Add(cl.reviewer, tbr)
1918 if cl.cc:
1919 about += "CC=" + JoinComma([CutDomain(s) for s in cl.cc]) + "\n"
1921 if not cl.reviewer:
1922 return "no reviewers listed in CL"
1924 if not cl.local:
1925 return "cannot submit non-local CL"
1927 # upload, to sync current patch and also get change number if CL is new.
1928 if not cl.copied_from:
1929 cl.Upload(ui, repo, gofmt_just_warn=True)
1931 # check gofmt for real; allowed upload to warn in order to save CL.
1932 cl.Flush(ui, repo)
1933 CheckFormat(ui, repo, cl.files)
1935 about += "%s%s\n" % (server_url_base, cl.name)
1937 if cl.copied_from:
1941 if not cl.mailed and not cl.copied_from: # in case this is TBR
1942 cl.Mail(ui, repo)
1945 message = cl.desc.rstrip() + "\n\n" + about
1948 set_status("pushing " + cl.name + " to remote server")
1957 ret = hg_commit(ui, repo, *['path:'+f for f in cl.files], message=message, user=userline)
2001 PostMessage(ui, cl.name, pmsg, reviewers="", cc=JoinComma(cl.reviewer+cl.cc))
2003 if not cl.copied_from:
2004 EditDesc(cl.name, closed=True, private=cl.private)
2005 cl.Delete(ui, repo)
2036 # potential references to http://.*/our-CL-number.
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))
2047 if not cl.copied_from:
2048 EditDesc(cl.name, closed=True, private=cl.private)
2049 cl.Delete(ui, repo)
2054 for cl in all.values():
2055 extra = Sub(cl.files, changed)
2057 ui.warn("Removing unmodified files from CL %s:\n" % (cl.name,))
2060 cl.files = Sub(cl.files, extra)
2061 cl.Flush(ui, repo)
2062 if not cl.files:
2063 if not cl.copied_from:
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))
2082 cl, err = LoadCL(ui, repo, name, web=True)
2085 if not cl.local:
2087 cl.Upload(ui, repo)
2088 print "%s%s\n" % (server_url_base, cl.name)
2108 ('D', 'deletelocal', None, 'delete locally, but do not change CL on server'),
2118 ('', 'ignore_hgpatch_failure', None, 'create CL metadata even if hgpatch fails'),
2177 ('', 'ignore_hgpatch_failure', None, 'create CL metadata even if hgpatch fails'),
2200 ('', 'ignore_hgpatch_failure', None, 'create CL metadata even if hgpatch fails'),
2374 def IsRietveldMailed(cl):
2375 for msg in cl.dict.get("messages", []):
2381 set_status("downloading CL " + clname)
2382 cl, err = LoadCL(ui, repo, clname, web=True)
2384 return None, None, None, "error loading CL %s: %s" % (clname, err)
2387 diffs = cl.dict.get("patchsets", [])
2389 return None, None, None, "CL has no patch sets"
2394 return None, None, None, "error loading CL patchset %s/%d" % (clname, patchid)
2407 email = cl.dict.get("owner_email", "")
2413 cl.mailed = IsRietveldMailed(cl)
2415 cl.copied_from = email
2417 return cl, vers, diffdata, ""