Commit dbbb48d9 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

obslog: remove the separate "obslog -f" implementation and use the common one

parent 52301aff269e
......@@ -90,11 +90,8 @@
revs = [b'.']
revs = scmutil.revrange(repo, revs)
# Use the default template unless the user provided one, but not if
# -f was given, because that doesn't work with templates yet. Note
# that --no-graph doesn't support -f (it ignores it), so we also
# don't use templating with --no-graph.
if not opts['template'] and not (opts['filternonlocal'] and opts['graph']):
# Use the default template unless the user provided one.
if not opts['template']:
opts['template'] = DEFAULT_TEMPLATE
if opts['graph']:
......@@ -195,7 +192,10 @@
if not markers:
continue
successors = succset[b"successors"]
_debugobshistorydisplaysuccsandmarkers(self.ui, markerfm, successors, markers, ctx.node(), self.repo, self._includediff)
_debugobshistorydisplaymarker(self.ui, markerfm,
successors, markers,
ctx.node(), self.repo,
self._includediff)
markerfm.end()
......@@ -588,120 +588,6 @@
else:
fm.data(nopatchreason=_patchavailable[1])
def _debugobshistorydisplaysuccsandmarkers(ui, fm, succnodes, markers, node, repo, includediff=False):
"""
This function is a duplication of _debugobshistorydisplaymarker modified
to accept multiple markers as input.
"""
fm.startitem()
fm.plain(b' ')
verb = _successorsetverb(succnodes, markers)[b"verb"]
fm.write(b'verb', b'%s', verb,
label=b"evolve.verb")
effects = _markerseffects(markers)
if effects:
fmteffect = fm.formatlist(effects, b'effect', sep=b', ')
fm.write(b'effects', b'(%s)', fmteffect)
if len(succnodes) > 0:
fm.plain(b' as ')
shortsnodes = (nodemod.short(succnode) for succnode in sorted(succnodes))
nodes = fm.formatlist(shortsnodes, b'succnode', sep=b', ')
fm.write(b'succnodes', b'%s', nodes,
label=b"evolve.node")
# Operations
operations = obsutil.markersoperations(markers)
if operations:
fm.plain(b' using ')
fm.write(b'operation', b'%s', b", ".join(operations), label=b"evolve.operation")
fm.plain(b' by ')
# Users
users = obsutil.markersusers(markers)
fm.write(b'user', b'%s', b", ".join(users),
label=b"evolve.user")
fm.plain(b' ')
# Dates
dates = obsutil.markersdates(markers)
if dates:
min_date = min(dates)
max_date = max(dates)
if min_date == max_date:
fm.write(b"date", b"(at %s)", fm.formatdate(min_date), label=b"evolve.date")
else:
fm.write(b"date", b"(between %s and %s)", fm.formatdate(min_date),
fm.formatdate(max_date), label=b"evolve.date")
# initial support for showing note
# if metadata.get('note'):
# fm.plain('\n note: ')
# fm.write('note', "%s", metadata['note'], label="evolve.note")
# Patch display
if includediff is True:
_patchavailable = patchavailable(node, repo, succnodes)
if _patchavailable[0] is True:
succ = _patchavailable[1]
basectx = repo[node]
succctx = repo[succ]
# Description patch
descriptionpatch = getmarkerdescriptionpatch(repo,
basectx.description(),
succctx.description())
if descriptionpatch:
# add the diffheader
diffheader = b"diff -r %s -r %s changeset-description\n" %\
(basectx, succctx)
descriptionpatch = diffheader + descriptionpatch
def tolist(text):
return [text]
ui.pushbuffer(labeled=True)
ui.write(b"\n")
for chunk, label in patch.difflabel(tolist, descriptionpatch):
chunk = chunk.strip(b'\t')
if chunk and chunk != b'\n':
ui.write(b' ')
ui.write(chunk, label=label)
fm.write(b'descdiff', b'%s', ui.popbuffer())
# Content patch
ui.pushbuffer(labeled=True)
diffopts = patch.diffallopts(repo.ui, {})
matchfn = scmutil.matchall(repo)
firstline = True
linestart = True
for chunk, label in patch.diffui(repo, node, succ, matchfn,
opts=diffopts):
if firstline:
ui.write(b'\n')
firstline = False
if linestart:
ui.write(b' ')
linestart = False
if chunk == b'\n':
linestart = True
ui.write(chunk, label=label)
fm.write(b'patch', b'%s', ui.popbuffer())
else:
fm.write(b'nopatchreason', b"\n (No patch available, %s)",
_patchavailable[1])
fm.plain(b"\n")
def _prepare_hunk(hunk):
"""Drop all information but the username and patch"""
cleanunk = []
......
......@@ -284,7 +284,7 @@
o eb5a0daa2192 (2) C0
|
x 471f378eab4c (1) A0
folded(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000)
folded(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
--- a/changeset-description
+++ b/changeset-description
......@@ -327,7 +327,7 @@
o eb5a0daa2192 (2) C0
|
x 471f378eab4c (1) A0
folded(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000)
folded(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000)
diff -r 471f378eab4c -r eb5a0daa2192 changeset-description
--- a/changeset-description
+++ b/changeset-description
......
......@@ -121,7 +121,7 @@
$ hg obslog -f -R $TESTTMP/server --patch 0dec01379d3b --hidden
x 0dec01379d3b (2) B0
pruned using prune by test (at Thu Jan 01 00:00:00 1970 +0000)
pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
(No patch available, no successors)
# TODO ADD amend + prune
......@@ -148,7 +148,7 @@
o 7a230b46bf61 (2) A2
|
@ 471f378eab4c (1) A0
reworded(description) as 7a230b46bf61 using amend by test (at Thu Jan 01 00:00:00 1970 +0000)
reworded(description) as 7a230b46bf61 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
diff -r 471f378eab4c -r 7a230b46bf61 changeset-description
--- a/changeset-description
+++ b/changeset-description
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment