Show More
@@ -800,11 +800,24 b' def creatediff(ctx):' | |||||
800 | """create a Differential Diff""" |
|
800 | """create a Differential Diff""" | |
801 | repo = ctx.repo() |
|
801 | repo = ctx.repo() | |
802 | repophid = getrepophid(repo) |
|
802 | repophid = getrepophid(repo) | |
803 |
# Create a "Differential Diff" via "differential.create |
|
803 | # Create a "Differential Diff" via "differential.creatediff" API | |
804 | params = {b'diff': getdiff(ctx, mdiff.diffopts(git=True, context=32767))} |
|
804 | pdiff = phabdiff( | |
|
805 | sourceControlBaseRevision=b'%s' % ctx.p1().hex(), | |||
|
806 | branch=b'%s' % ctx.branch(), | |||
|
807 | ) | |||
|
808 | modified, added, removed, _d, _u, _i, _c = ctx.p1().status(ctx) | |||
|
809 | # addadded will remove moved files from removed, so addremoved won't get | |||
|
810 | # them | |||
|
811 | addadded(pdiff, ctx, added, removed) | |||
|
812 | addmodified(pdiff, ctx, modified) | |||
|
813 | addremoved(pdiff, ctx, removed) | |||
805 | if repophid: |
|
814 | if repophid: | |
806 |
p |
|
815 | pdiff.repositoryPHID = repophid | |
807 | diff = callconduit(repo.ui, b'differential.createrawdiff', params) |
|
816 | diff = callconduit( | |
|
817 | repo.ui, | |||
|
818 | b'differential.creatediff', | |||
|
819 | pycompat.byteskwargs(attr.asdict(pdiff)), | |||
|
820 | ) | |||
808 | if not diff: |
|
821 | if not diff: | |
809 | raise error.Abort(_(b'cannot create diff for %s') % ctx) |
|
822 | raise error.Abort(_(b'cannot create diff for %s') % ctx) | |
810 | return diff |
|
823 | return diff | |
@@ -812,8 +825,10 b' def creatediff(ctx):' | |||||
812 |
|
825 | |||
813 | def writediffproperties(ctx, diff): |
|
826 | def writediffproperties(ctx, diff): | |
814 | """write metadata to diff so patches could be applied losslessly""" |
|
827 | """write metadata to diff so patches could be applied losslessly""" | |
|
828 | # creatediff returns with a diffid but query returns with an id | |||
|
829 | diffid = diff.get(b'diffid', diff.get(b'id')) | |||
815 | params = { |
|
830 | params = { | |
816 |
b'diff_id': diff |
|
831 | b'diff_id': diffid, | |
817 | b'name': b'hg:meta', |
|
832 | b'name': b'hg:meta', | |
818 | b'data': templatefilters.json( |
|
833 | b'data': templatefilters.json( | |
819 | { |
|
834 | { | |
@@ -828,7 +843,7 b' def writediffproperties(ctx, diff):' | |||||
828 | callconduit(ctx.repo().ui, b'differential.setdiffproperty', params) |
|
843 | callconduit(ctx.repo().ui, b'differential.setdiffproperty', params) | |
829 |
|
844 | |||
830 | params = { |
|
845 | params = { | |
831 |
b'diff_id': diff |
|
846 | b'diff_id': diffid, | |
832 | b'name': b'local:commits', |
|
847 | b'name': b'local:commits', | |
833 | b'data': templatefilters.json( |
|
848 | b'data': templatefilters.json( | |
834 | { |
|
849 | { |
General Comments 0
You need to be logged in to leave comments.
Login now