Beispiel #1
0
def debugcommitmessage(ui, repo, *args):
    form = None
    if len(args) > 1:
        raise error.Abort(_("provide at most one form"))
    elif len(args) > 0:
        form = args[0]

    status = repo.status()
    text = ""
    user = None
    date = None
    extra = None

    ctx = context.workingcommitctx(repo, status, text, user, date, extra)

    editform = form or "commit.normal.normal"
    extramsg = _("Leave message empty to abort commit.")

    forms = [e for e in editform.split(".") if e]
    forms.insert(0, "changeset")
    while forms:
        ref = ".".join(forms)
        tmpl = repo.ui.config("committemplate", ref)
        if tmpl:
            committext = cmdutil.buildcommittemplate(repo, ctx, extramsg, ref)
            break
        forms.pop()
    else:
        committext = cmdutil.buildcommittext(repo, ctx, extramsg)

    ui.status(committext)
Beispiel #2
0
def createsnapshotcommit(ui, repo, opts):
    status = repo.status(unknown=True)
    snapmetadata = snapshotmetadata.createfromworkingcopy(repo, status=status)
    emptymetadata = snapmetadata.empty
    oid = ""  # this is better than None because of extra serialization rules
    if not emptymetadata:
        oid = snapmetadata.storelocally(repo)
    extra = {"snapshotmetadataid": oid}
    ui.debug("snapshot extra %s\n" % extra)
    text = opts.get("message") or "snapshot"
    cctx = context.workingcommitctx(
        repo, status, text, opts.get("user"), opts.get("date"), extra=extra
    )
    if len(cctx.files()) == 0 and emptymetadata:  # don't need an empty snapshot
        return None
    with repo.transaction("snapshot"):
        return repo.commitctx(cctx, error=True), snapmetadata
Beispiel #3
0
print('=== with "pattern match":')
print(actx1.status(other=wctx, match=scmutil.matchfiles(repo, ["bar-m", "foo"])))
print("wctx._status=%s" % (str(wctx._status)))
print(actx2.status(other=wctx, match=scmutil.matchfiles(repo, ["bar-m", "foo"])))
print("wctx._status=%s" % (str(wctx._status)))

print('=== with "always match" and "listclean=True":')
print(actx1.status(other=wctx, listclean=True))
print("wctx._status=%s" % (str(wctx._status)))
print(actx2.status(other=wctx, listclean=True))
print("wctx._status=%s" % (str(wctx._status)))

print("== checking workingcommitctx.status:")

wcctx = context.workingcommitctx(
    repo, scmutil.status(["bar-m"], ["bar-a"], [], [], [], [], []), text="", date="0 0"
)
print("wcctx._status=%s" % (str(wcctx._status)))

print('=== with "always match":')
print(actx1.status(other=wcctx))
print("wcctx._status=%s" % (str(wcctx._status)))
print(actx2.status(other=wcctx))
print("wcctx._status=%s" % (str(wcctx._status)))

print('=== with "always match" and "listclean=True":')
print(actx1.status(other=wcctx, listclean=True))
print("wcctx._status=%s" % (str(wcctx._status)))
print(actx2.status(other=wcctx, listclean=True))
print("wcctx._status=%s" % (str(wcctx._status)))