D4341: sparse: add local files to temporaryfiles if they exist out of sparse

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Aug 21 13:22:17 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We get the f1 from agrs if possible and check that whether that exists in sparse
  checkout or not. If that does not, we add that for merging.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4341

AFFECTED FILES
  mercurial/sparse.py
  tests/test-sparse-merges.t
  tests/test-sparse-profiles.t
  tests/test-sparse.t

CHANGE DETAILS

diff --git a/tests/test-sparse.t b/tests/test-sparse.t
--- a/tests/test-sparse.t
+++ b/tests/test-sparse.t
@@ -189,7 +189,7 @@
 
   $ hg rebase -d 1 -r 2 --config extensions.rebase=
   rebasing 2:b91df4f39e75 "edit hide" (tip)
-  temporarily included 1 file(s) in the sparse checkout for merging
+  temporarily included 2 file(s) in the sparse checkout for merging
   merging hide
   warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
@@ -224,7 +224,7 @@
 
   $ hg up -q 1
   $ hg merge -r 2
-  temporarily included 1 file(s) in the sparse checkout for merging
+  temporarily included 2 file(s) in the sparse checkout for merging
   merging hide
   warning: conflicts while merging hide! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
diff --git a/tests/test-sparse-profiles.t b/tests/test-sparse-profiles.t
--- a/tests/test-sparse-profiles.t
+++ b/tests/test-sparse-profiles.t
@@ -119,7 +119,7 @@
 Verify conflicting merge pulls in the conflicting changes
 
   $ hg merge 1
-  temporarily included 1 file(s) in the sparse checkout for merging
+  temporarily included 2 file(s) in the sparse checkout for merging
   merging backend.sparse
   merging data.py
   warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark')
@@ -184,7 +184,7 @@
 
   $ hg rebase -d 2
   rebasing 1:a2b1de640a62 "edit profile"
-  temporarily included 1 file(s) in the sparse checkout for merging
+  temporarily included 2 file(s) in the sparse checkout for merging
   merging backend.sparse
   merging data.py
   warning: conflicts while merging backend.sparse! (edit, then use 'hg resolve --mark')
diff --git a/tests/test-sparse-merges.t b/tests/test-sparse-merges.t
--- a/tests/test-sparse-merges.t
+++ b/tests/test-sparse-merges.t
@@ -112,7 +112,7 @@
   a
 
   $ hg merge
-  temporarily included 1 file(s) in the sparse checkout for merging
+  temporarily included 2 file(s) in the sparse checkout for merging
   local [working copy] changed d which other [merge rev] deleted
   use (c)hanged version, (d)elete, or leave (u)nresolved? u
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
@@ -171,10 +171,13 @@
   d
 
   $ hg merge
-  abort: $ENOENT$: $TESTTMP/mvtest/a
-  [255]
+  temporarily included 1 file(s) in the sparse checkout for merging
+  merging a and amove to amove
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
 
   $ hg up -C 4
+  cleaned up 1 temporarily added file(s) from the sparse checkout
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg merge
diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -361,6 +361,14 @@
         elif file in wctx:
             prunedactions[file] = ('r', args, msg)
 
+        if branchmerge:
+            try:
+                f1, f2, fa, move, anc = args
+                if not sparsematch(f1):
+                    temporaryfiles.append(f1)
+            except ValueError:
+                pass
+
     if len(temporaryfiles) > 0:
         repo.ui.status(_('temporarily included %d file(s) in the sparse '
                          'checkout for merging\n') % len(temporaryfiles))



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list