##// END OF EJS Templates
log: pass getcopies() function instead of getrenamed() to displayer (API)...
Martin von Zweigbergk -
r42704:a68350a7 default
parent child Browse files
Show More
@@ -3887,12 +3887,12 b' def log(ui, repo, *pats, **opts):'
3887 # then filter the result by logcmdutil._makerevset() and --limit
3887 # then filter the result by logcmdutil._makerevset() and --limit
3888 revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
3888 revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
3889
3889
3890 getrenamed = None
3890 getcopies = None
3891 if opts.get('copies'):
3891 if opts.get('copies'):
3892 endrev = None
3892 endrev = None
3893 if revs:
3893 if revs:
3894 endrev = revs.max() + 1
3894 endrev = revs.max() + 1
3895 getrenamed = scmutil.getrenamedfn(repo, endrev=endrev)
3895 getcopies = scmutil.getcopiesfn(repo, endrev=endrev)
3896
3896
3897 ui.pager('log')
3897 ui.pager('log')
3898 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, differ,
3898 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, differ,
@@ -3901,7 +3901,7 b' def log(ui, repo, *pats, **opts):'
3901 displayfn = logcmdutil.displaygraphrevs
3901 displayfn = logcmdutil.displaygraphrevs
3902 else:
3902 else:
3903 displayfn = logcmdutil.displayrevs
3903 displayfn = logcmdutil.displayrevs
3904 displayfn(ui, repo, revs, displayer, getrenamed)
3904 displayfn(ui, repo, revs, displayer, getcopies)
3905
3905
3906 @command('manifest',
3906 @command('manifest',
3907 [('r', 'rev', '', _('revision to display'), _('REV')),
3907 [('r', 'rev', '', _('revision to display'), _('REV')),
@@ -862,7 +862,7 b' def _graphnodeformatter(ui, displayer):'
862 return templ.renderdefault(props)
862 return templ.renderdefault(props)
863 return formatnode
863 return formatnode
864
864
865 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, props=None):
865 def displaygraph(ui, repo, dag, displayer, edgefn, getcopies=None, props=None):
866 props = props or {}
866 props = props or {}
867 formatnode = _graphnodeformatter(ui, displayer)
867 formatnode = _graphnodeformatter(ui, displayer)
868 state = graphmod.asciistate()
868 state = graphmod.asciistate()
@@ -890,13 +890,7 b' def displaygraph(ui, repo, dag, displaye'
890
890
891 for rev, type, ctx, parents in dag:
891 for rev, type, ctx, parents in dag:
892 char = formatnode(repo, ctx)
892 char = formatnode(repo, ctx)
893 copies = None
893 copies = getcopies(ctx) if getcopies else None
894 if getrenamed:
895 copies = []
896 for fn in ctx.files():
897 rename = getrenamed(fn, ctx.rev())
898 if rename:
899 copies.append((fn, rename))
900 edges = edgefn(type, char, state, rev, parents)
894 edges = edgefn(type, char, state, rev, parents)
901 firstedge = next(edges)
895 firstedge = next(edges)
902 width = firstedge[2]
896 width = firstedge[2]
@@ -915,16 +909,10 b' def displaygraphrevs(ui, repo, revs, dis'
915 revdag = graphmod.dagwalker(repo, revs)
909 revdag = graphmod.dagwalker(repo, revs)
916 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed)
910 displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed)
917
911
918 def displayrevs(ui, repo, revs, displayer, getrenamed):
912 def displayrevs(ui, repo, revs, displayer, getcopies):
919 for rev in revs:
913 for rev in revs:
920 ctx = repo[rev]
914 ctx = repo[rev]
921 copies = None
915 copies = getcopies(ctx) if getcopies else None
922 if getrenamed is not None:
923 copies = []
924 for fn in ctx.files():
925 rename = getrenamed(fn, rev)
926 if rename:
927 copies.append((fn, rename))
928 displayer.show(ctx, copies=copies)
916 displayer.show(ctx, copies=copies)
929 displayer.flush(ctx)
917 displayer.flush(ctx)
930 displayer.close()
918 displayer.close()
General Comments 0
You need to be logged in to leave comments. Login now