Пример #1
0
def qrefresh_wrapper(orig, self, repo, *pats, **opts):
    mqmessage = opts.pop('mqmessage', '') or '%a: %p\n%s%Q'
    mqcommit, q, r = mqcommit_info(self, repo, opts)

    diffstat = ""
    if mqcommit and mqmessage:
        if mqmessage.find("%s") != -1:
            self.pushbuffer()
            m = cmdutil.matchmod.match(repo.root, repo.getcwd(), [],
                                       opts.get('include'), opts.get('exclude'),
                                       'relpath', auditor=repo.auditor)
            cmdutil.diffordiffstat(self, repo, mdiff.diffopts(),
                                   repo.dirstate.parents()[0], None, m,
                                   stat=True)
            diffstat = self.popbuffer()

    ret = orig(self, repo, *pats, **opts)
    if ret:
        return ret

    if mqcommit and len(q.applied) > 0:
        patch = q.applied[-1].name
        if r is None:
            raise util.Abort("no patch repository found when using -Q option")
        mqmessage = substitute_mqmessage(mqmessage, repo, { 'p': patch,
                                                            'a': 'UPDATE',
                                                            's': diffstat })
        commands.commit(r.ui, r, message=mqmessage)
Пример #2
0
def qrefresh_wrapper(self, repo, *pats, **opts):
    mqmessage = opts.pop('mqmessage', None)
    mqcommit, q, r = mqcommit_info(self, repo, opts)

    diffstat = ""
    if mqcommit and mqmessage:
        if mqmessage.find("%s") != -1:
            buffer = StringIO.StringIO()
            m = cmdutil.match(repo, None, {})
            diffopts = mdiff.diffopts()
            cmdutil.diffordiffstat(self, repo, diffopts,
                                   repo.dirstate.parents()[0], None, m,
                                   stat=True, fp = buffer)
            diffstat = buffer.getvalue()
            buffer.close()

    mq.refresh(self, repo, *pats, **opts)

    if mqcommit and len(q.applied) > 0:
        patch = q.applied[-1].name
        if r is None:
            raise util.Abort("no patch repository found when using -Q option")
        mqmessage = mqmessage.replace("%p", patch)
        mqmessage = mqmessage.replace("%a", 'UPDATE')
        mqmessage = mqmessage.replace("%s", diffstat)
        commands.commit(r.ui, r, message=mqmessage)
Пример #3
0
def qrefresh_wrapper(orig, self, repo, *pats, **opts):
    mqmessage = opts.pop('mqmessage', '') or '%a: %p\n%s%Q'
    mqcommit, q, r = mqcommit_info(self, repo, opts)

    diffstat = ""
    if mqcommit and mqmessage:
        if mqmessage.find("%s") != -1:
            self.pushbuffer()
            m = cmdutil.matchmod.match(repo.root, repo.getcwd(), [],
                                       opts.get('include'), opts.get('exclude'),
                                       'relpath', auditor=repo.auditor)
            cmdutil.diffordiffstat(self, repo, mdiff.diffopts(),
                                   repo.dirstate.parents()[0], None, m,
                                   stat=True)
            diffstat = self.popbuffer()

    ret = orig(self, repo, *pats, **opts)
    if ret:
        return ret

    if mqcommit and len(q.applied) > 0:
        patch = q.applied[-1].name
        if r is None:
            raise util.Abort("no patch repository found when using -Q option")
        mqmessage = substitute_mqmessage(mqmessage, repo, { 'p': patch,
                                                            'a': 'UPDATE',
                                                            's': diffstat })
        commands.commit(r.ui, r, message=mqmessage)
Пример #4
0
def diff_branch(ui, repo, branch, **opts):
    """Shows the changes from a branch"""
    if branch not in repo.branchtags():
        ui.warn("Branch %s does not exist! (use 'hg branches' to get a list of branches)\n" % branch)
        return
    curr = repo[None].branch()
    if branch == curr:
        ui.status("Already on branch %s\n" % branch)
        return
    rev = repo.branchtip(branch)
    dest = "default"
    drev = repo.branchtip(dest)
    ancestor = repo.changelog.ancestor(rev, drev)
    diffopts = patch.diffopts(ui, opts)
    cmdutil.diffordiffstat(ui, repo, diffopts, ancestor, rev, None)
Пример #5
0
 def printdiff(self, repo, diffopts, node1, node2=None, files=None,
               fp=None, changes=None, opts={}):
     stat = opts.get('stat')
     m = scmutil.match(repo[node1], files, opts)
     cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2,  m,
                            changes, stat, fp)