Patchwork shelve: unshelve using an unfiltered repository

login
register
mail settings
Submitter David Soria Parra
Date Nov. 8, 2013, 6:55 a.m.
Message ID <cf883126f4894744c1ea.1383893736@davidsp-mbp.local>
Download mbox | patch
Permalink /patch/2888/
State Superseded, archived
Headers show

Comments

David Soria Parra - Nov. 8, 2013, 6:55 a.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1383885386 28800
#      Thu Nov 07 20:36:26 2013 -0800
# Node ID cf883126f4894744c1ea5cb4795f0003c7f55e56
# Parent  aa80446aacc3b1574211649cd8f190250b6b04b3
shelve: unshelve using an unfiltered repository

when evolve is enabled and a hidden obsolete changeset exists
in the repository, the strip during unshelve will fail due to
filtered revs. we use an unfiltered repository like to
repair.strip to strip the proper nodes.
Pierre-Yves David - Nov. 8, 2013, 9:33 a.m.
On 8 nov. 2013, at 07:55, David Soria Parra wrote:

> # HG changeset patch
> # User David Soria Parra <davidsp@fb.com>
> # Date 1383885386 28800
> #      Thu Nov 07 20:36:26 2013 -0800
> # Node ID cf883126f4894744c1ea5cb4795f0003c7f55e56
> # Parent  aa80446aacc3b1574211649cd8f190250b6b04b3
> shelve: unshelve using an unfiltered repository
> 
> when evolve is enabled and a hidden obsolete changeset exists
> in the repository, the strip during unshelve will fail due to
> filtered revs. we use an unfiltered repository like to
> repair.strip to strip the proper nodes.

If strip need an unfiltered repo, why don't you use an unfiltered repo just for strip ?

> 
> diff -r aa80446aacc3 -r cf883126f489 hgext/shelve.py
> --- a/hgext/shelve.py	Wed Nov 06 12:53:39 2013 -0500
> +++ b/hgext/shelve.py	Thu Nov 07 20:36:26 2013 -0800
> @@ -486,6 +486,7 @@
>     """
>     abortf = opts['abort']
>     continuef = opts['continue']
> +    repo = repo.unfiltered()
>     if not abortf and not continuef:
>         cmdutil.checkunfinished(repo)

Patch

diff -r aa80446aacc3 -r cf883126f489 hgext/shelve.py
--- a/hgext/shelve.py	Wed Nov 06 12:53:39 2013 -0500
+++ b/hgext/shelve.py	Thu Nov 07 20:36:26 2013 -0800
@@ -486,6 +486,7 @@ 
     """
     abortf = opts['abort']
     continuef = opts['continue']
+    repo = repo.unfiltered()
     if not abortf and not continuef:
         cmdutil.checkunfinished(repo)
 
diff -r aa80446aacc3 -r cf883126f489 tests/test-shelve.t
--- a/tests/test-shelve.t	Wed Nov 06 12:53:39 2013 -0500
+++ b/tests/test-shelve.t	Thu Nov 07 20:36:26 2013 -0800
@@ -520,4 +520,23 @@ 
   $ hg status
   A d
 
+test bug 4073 we need to enable obsolete markers for it
+
+  $ cat > ../obs.py << EOF
+  > import mercurial.obsolete
+  > mercurial.obsolete._enabled = True
+  > EOF
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+  $ hg shelve
+  shelved as default
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg debugobsolete `hg --debug id -i -r 1`
+  $ hg unshelve
+  unshelving change 'default'
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 2 files (+1 heads)
+
   $ cd ..