Patchwork [6,of,6,V2] shelve: remove useless stripping changelog at unshelve

mail settings
Submitter Katsunori FUJIWARA
Date Dec. 16, 2015, 5:50 p.m.
Message ID <a7b593631779243ebe55.1450288254@feefifofum>
Download mbox | patch
Permalink /patch/12074/
State Superseded
Headers show


Katsunori FUJIWARA - Dec. 16, 2015, 5:50 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <>
# Date 1450287754 -32400
#      Thu Dec 17 02:42:34 2015 +0900
# Node ID a7b593631779243ebe5567025a02fc8525103cbd
# Parent  e979be8dbd88dec14bd97729a9f837b6d91ba0ed
shelve: remove useless stripping changelog at unshelve

Before this patch, "hg unshelve" strips changelog explicitly for
historical reason below at 1d7a36ff2615, which made unshelve use
rebase instead of merge:

    'repo.addchangegroup()' scheduled to run 'changegroup' hooks by
    'repo._afterlock()', which invokes registered functions always at
    releasing the outermost lock.

    Therefore, 'changegroup' hooks were invoked unintentionally, even
    though "hg unshelve" aborts running transaction to discard

But now, 'changegroup.addchangegroup()' schedules to run 'changegroup'
hooks by 'transaction.addpostclose()', and hooks are never invoked at
failure of transaction.

Therefore, this patch removes useless stripping changelog at unshelve.


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -746,12 +746,6 @@  def _dounshelve(ui, repo, *shelved, **op
         mergefiles(ui, repo, pctx, shelvectx)
-        # The transaction aborting will strip all the commits for us,
-        # but it doesn't update the inmemory structures, so addchangegroup
-        # hooks still fire and try to operate on the missing commits.
-        # Clean up manually to prevent this.
-        repo.unfiltered().changelog.strip(oldtiprev, tr)
         unshelvecleanup(ui, repo, basename, opts)
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -78,7 +78,10 @@  specified)
   shelved as default
   0 files updated, 0 files merged, 5 files removed, 0 files unresolved
-  $ hg unshelve
+(unshelve below confirms also that changegroup hook isn't invoked at
+failure ( = intentional for "hg unshelve") of transaction)
+  $ hg unshelve --config hooks.changegroup=false
   unshelving change 'default'
   $ hg commit -q -m 'initial commit'