[PATCH RFC] patch: Always ensure valid git diffs in case source/destination file is missing (issue4046)
Johan Bjork
jbjoerk at gmail.com
Sun Oct 13 07:50:59 CDT 2013
# HG changeset patch
# User Johan Bjork <jbjoerk at gmail.com>
# Date 1381667910 14400
# Sun Oct 13 08:38:30 2013 -0400
# Node ID 9b5bc4626c30f9b8564238824618376f08992d3c
# Parent 1b2f9d36953e6ed384a044c1e73cb3a1aa072004
patch: Always ensure valid git diffs in case source/destination file is missing (issue4046)
This is arguably a workaround, a better fix may be in the repo to ensure that it won't list a file 'modified' unless
there is a file context for the previous version.
diff -r 1b2f9d36953e -r 9b5bc4626c30 mercurial/patch.py
--- a/mercurial/patch.py Mon Sep 30 18:27:42 2013 -0700
+++ b/mercurial/patch.py Sun Oct 13 08:38:30 2013 -0400
@@ -1703,7 +1703,7 @@
tn = getfilectx(f, ctx2).data()
a, b = f, f
if opts.git or losedatafn:
- if f in added:
+ if f in added or not to:
mode = gitmode[ctx2.flags(f)]
if f in copy or f in copyto:
if opts.git:
@@ -1739,7 +1739,7 @@
if not opts.git and not tn:
# regular diffs cannot represent new empty file
losedatafn(f)
- elif f in removed:
+ elif f in removed or not tn:
if opts.git:
# have we already reported a copy above?
if ((f in copy and copy[f] in added
More information about the Mercurial-devel
mailing list