def instance(ui, path, create): if create: raise util.Abort(_('cannot create new union repository')) parentpath = ui.config("bundle", "mainreporoot", "") if not parentpath: # try to find the correct path to the working directory repo parentpath = cmdutil.findrepo(os.getcwd()) if parentpath is None: parentpath = '' if parentpath: # Try to make the full path relative so we get a nice, short URL. # In particular, we don't want temp dir names in test outputs. cwd = os.getcwd() if parentpath == cwd: parentpath = '' else: cwd = os.path.join(cwd, '') if parentpath.startswith(cwd): parentpath = parentpath[len(cwd):] if path.startswith('union:'): s = path.split(":", 1)[1].split("+", 1) if len(s) == 1: repopath, repopath2 = parentpath, s[0] else: repopath, repopath2 = s else: repopath, repopath2 = parentpath, path return unionrepository(ui, repopath, repopath2)
def main(argv=None): if argv is None: argv = sys.argv parser = OptionParser() (options, args) = parser.parse_args() myui = ui.ui() repo = hg.repository(myui, cmdutil.findrepo(os.getcwd())) changes = {} for revNum in xrange(len(repo)): rev = repo[revNum] for file in rev.files(): changes.setdefault(file, []).append(rev) postval = {} for file in changes: postval[file] = {"reviewers": {}, "super-reviewers": {}, "ui-reviewers": {} } for change in changes[file]: for person in (canon(x) for x in suckerRe.findall(change.description())): postval[file]["reviewers"][person] = postval[file]["reviewers"].setdefault(person, 0) + 1 for person in (canon(x) for x in supersuckerRe.findall(change.description())): postval[file]["super-reviewers"][person] = postval[file]["super-reviewers"].setdefault(person, 0) + 1 for person in (canon(x) for x in uisuckerRe.findall(change.description())): postval[file]["ui-reviewers"][person] = postval[file]["ui-reviewers"].setdefault(person, 0) + 1 print json.dumps(postval) return 0
def setPath(self, path): spath = hglib.fromunicode(path) reporoot = cmdutil.findrepo(os.path.abspath(spath)) if not reporoot: QMessageBox.warning(self, 'Repository Not Found', 'Repository not found for path: %s' % path) repo = hg.repository(ui.ui(), reporoot) canonpath = util.canonpath(repo.root, os.getcwd(), spath) self._plot.plot(repo, canonpath)
def main(argv=None): if argv is None: argv = sys.argv parser = OptionParser() (options, args) = parser.parse_args() myui = ui.ui() repo = hg.repository(myui, cmdutil.findrepo(os.getcwd())) if len(args) == 0: # we should use the current diff, or if that is empty, the top applied # patch in the patch queue myui.pushbuffer() commands.diff(myui, repo, git=True) diff = myui.popbuffer() changedFiles = fileRe.findall(diff) if len(changedFiles) == 0: print("Patch source: top patch in mq queue") myui.pushbuffer() commands.diff(myui, repo, change="qtip", git=True) diff = myui.popbuffer() else: print("Patch source: current diff") else: diff = url.open(myui, args[0]).read() print("Patch source: %s" % args[0]) changedFiles = fileRe.findall(diff) changes = {} for changedFile in changedFiles: changes[changedFile] = [] for revNum in xrange(len(repo) - SEARCH_DEPTH, len(repo)): rev = repo[revNum] for file in changedFiles: if file in rev.files(): changes[file].append(rev) suckers = Counter() supersuckers = Counter() uisuckers = Counter() for file in changes: for change in changes[file]: suckers.update(canon(x) for x in suckerRe.findall(change.description())) supersuckers.update(canon(x) for x in supersuckerRe.findall(change.description())) uisuckers.update(canon(x) for x in uisuckerRe.findall(change.description())) print "Potential reviewers:" for (reviewer, count) in suckers.most_common(10): print " %s: %d" % (reviewer, count) print print "Potential super-reviewers:" for (reviewer, count) in supersuckers.most_common(10): print " %s: %d" % (reviewer, count) print print "Potential ui-reviewers:" for (reviewer, count) in uisuckers.most_common(10): print " %s: %d" % (reviewer, count) print return 0
def get_working_copy(path=None): repo_dir = findrepo(path or os.getcwd()) if repo_dir: return MercurialWorkingCopy(repo_dir) else: raise VersionControlError("No Mercurial working copy found at %s" % path)
def may_have_working_copy(path=None): path = path or os.getcwd() return bool(findrepo(path))
for order, key, value, src in items: cfg.set(section, key, value, src) def readcurrentprojrc(repo): """Return the contents of the current projrc file""" return repo_read(repo, 'projrc') def readprojrc(ui, rpath): # Modelled after dispatch._getlocal but reads the projrc settings # directly into the ui object. try: wd = os.getcwd() except OSError, e: raise util.Abort(_("error getting current working directory: %s") % e.strerror) path = cmdutil.findrepo(wd) or "" if path: loadprojrc(ui, os.path.join(path, ".hg", "projrc"), path) if rpath: path = ui.expandpath(rpath[-1]) loadprojrc(ui, os.path.join(path, ".hg", "projrc"), path) def getprojrcserverset(ui): """Get the list of projrc servers, normalizing paths and character cases""" serverlist = ui.configlist('projrc', 'servers') for n, server in enumerate(serverlist): server = ui.expandpath(server) filepath = isfilepath(server) if filepath:
def exists(self): return bool(self.path and findrepo(self.path))
def __init__(self, path=None): WorkingCopy.__init__(self, path) self.path = findrepo(self.path) self.repository = MercurialRepository(self.path)