diff tests/test-mq-subrepo.t @ 17152:f287d4a62031

mq: create patch file after commit to import diff of ".hgsubstate" at qrefresh Even though the committed revision contains diff of ".hgsubstate", the patch file created by qrefresh doesn't contain it, because: - ".hgsubstate" is not listed up as one of target files of the patch for reasons below, so diff of ".hgsubstate" is not imported into patch file - status of ".hgsubstate" in working directory is usually "clean" - ".hgsubstate" is not specified explicitly by users - the patch file is created before commit processing which updates or creates ".hgsubstate" automatically, so there is no diff for it at that time This patch resolves this problem by: - putting ".hgsubstate" into target list of the patch, if needed: this allows "patch.diff()" to import diff of ".hgsubstate" into patch file. - creating the patch file after commit processing: this updates ".hgsubstate" before "patch.diff()" invocation. For the former fixing, this patch introduces "putsubstate2changes()" to share same implementation with qnew. This is invoked only once per qnew/qrefresh at most, so there is less performance impact. This patch also omits "match" argument for "patch.diff()" invocation, because "patch.diff()" ignores "match" if "changes" is specified.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 27 Jun 2012 22:03:27 +0900
parents 986df5249b65
children 54da604fefee
line wrap: on
line diff
--- a/tests/test-mq-subrepo.t	Wed Jun 27 22:03:22 2012 +0900
+++ b/tests/test-mq-subrepo.t	Wed Jun 27 22:03:27 2012 +0900
@@ -412,6 +412,35 @@
   applying import-at-qnew
   now at: import-at-qnew
 
+  $ hg qnew import-at-qrefresh
+  $ echo sb > sub/sb
+  $ hg -R sub commit -u test -d '0 0' -Am '#1 in sub'
+  adding sb
+  $ hg qrefresh -u test -d '0 0'
+  $ hg -R sub parents --template '{node} sub\n'
+  88ac1bef5ed43b689d1d200b59886b675dec474b sub
+  $ cat .hgsubstate
+  88ac1bef5ed43b689d1d200b59886b675dec474b sub
+  $ hg diff -c tip
+  diff -r 44f846335325 -r b3e8c5fa3aaa .hgsubstate
+  --- a/.hgsubstate
+  +++ b/.hgsubstate
+  @@ -1,1 +1,1 @@
+  -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
+  +88ac1bef5ed43b689d1d200b59886b675dec474b sub
+  $ cat .hg/patches/import-at-qrefresh
+  # HG changeset patch
+  # Date 0 0
+  # User test
+  # Parent 44f846335325209be6be35dc2c9a4be107278c09
+  
+  diff -r 44f846335325 .hgsubstate
+  --- a/.hgsubstate
+  +++ b/.hgsubstate
+  @@ -1,1 +1,1 @@
+  -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
+  +88ac1bef5ed43b689d1d200b59886b675dec474b sub
+
   $ cd ..
 
   $ cd ..