[Bug 5454] New: As a HG user, when using diff --git to get parent revision of a patch

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Thu Dec 22 01:22:34 EST 2016


https://bz.mercurial-scm.org/show_bug.cgi?id=5454

            Bug ID: 5454
           Summary: As a HG user, when using diff --git to get parent
                    revision of a patch
           Product: Mercurial
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: glewandowski at atlassian.com
                CC: mercurial-devel at selenic.com

Currently, Mercurial generates diff in a git-style format without HASH of
parent revisions for particular files. E.g. let's assume you have repository
with some modifications present and you run  _hg diff --git_ the output will be
similar to the following:

diff --git a/file b/file
--- a/file
+++ b/file
@@ -1,2 +1,3 @@
 Thu Dec 22 12:09:30 CET 2016
 Thu Dec 22 12:09:40 CET 2016
+Thu Dec 22 12:10:21 CET 2016
diff --git a/file2 b/renamed_file2
rename from file2
rename to renamed_file2


Note that any of the files in the diff don't have SHA hashes. When it comes to
moving files, it's common behaviour with GIT, however for file modification GIT
provides parent revisions, Mercurial does not (take look at _file_). However,
when using Mercurial standard diff format, HG provides parent revision
information:

$ hg diff
diff -r d7fddeeefd54 file
--- a/file      Thu Dec 22 12:10:12 2016 +0100
+++ b/file      Thu Dec 22 12:19:23 2016 +0100
@@ -1,2 +1,3 @@
 Thu Dec 22 12:09:30 CET 2016
 Thu Dec 22 12:09:40 CET 2016
+Thu Dec 22 12:10:21 CET 2016
diff -r d7fddeeefd54 file2
--- a/file2     Thu Dec 22 12:10:12 2016 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Thu Dec 22 12:10:03 CET 2016
diff -r d7fddeeefd54 renamed_file2
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/renamed_file2     Thu Dec 22 12:19:23 2016 +0100
@@ -0,0 +1,1 @@
+Thu Dec 22 12:10:03 CET 2016

Can we make this consistent and provide parent revision always, no matter which
diff format was chosen? Can MQ extension and _qdiff_ command be also consistent
with the behaviour?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list