Patchwork [STABLE] clone: do not turn hidden changeset public on publishing clone (issue3935)

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 30, 2014, 8:37 p.m.
Message ID <52EAB804.1040100@ens-lyon.org>
Download mbox | patch
Permalink /patch/3421/
State Superseded
Commit a959f71670771a9dae97e73ec86da222950233a4
Headers show

Comments

Pierre-Yves David - Jan. 30, 2014, 8:37 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1391111558 28800
#      Thu Jan 30 11:52:38 2014 -0800
# Branch stable
# Node ID 4cd3a83faa488d6aef4fde615461e6307fa124de
# Parent  427d672c0e4e07642d2400a28946cefde11e04ff
clone: do not turn hidden changeset public on publishing clone (issue3935)

Before this changeset local clone of a repo with hidden changeset would 
include
then in the clone (why not) and turn them public (plain wrong). This 
happened
because the copy clone publish by dropping the phaseroot file entirely 
making
everything in the repo public (and therefore immune to obsolescence marker).

This changeset takes the simplest fix, we deny the copy clone in the 
case of hidden
changeset falling back to pull clone that will exclude them from the 
clone and
therefore not turning them public.

A smarter version of copy clone could be done, but I prefer to go for the
simplest solution first.
Augie Fackler - Jan. 30, 2014, 8:40 p.m.
On Thu, Jan 30, 2014 at 3:37 PM, Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@logilab.fr>
> # Date 1391111558 28800
> #      Thu Jan 30 11:52:38 2014 -0800
> # Branch stable
> # Node ID 4cd3a83faa488d6aef4fde615461e6307fa124de
> # Parent  427d672c0e4e07642d2400a28946cefde11e04ff
> clone: do not turn hidden changeset public on publishing clone (issue3935)
>

Looks right, but mpm will probably want this without tests for stable?


>
> Before this changeset local clone of a repo with hidden changeset would
> include
> then in the clone (why not) and turn them public (plain wrong). This
> happened
> because the copy clone publish by dropping the phaseroot file entirely
> making
> everything in the repo public (and therefore immune to obsolescence
> marker).
>
> This changeset takes the simplest fix, we deny the copy clone in the case
> of hidden
> changeset falling back to pull clone that will exclude them from the clone
> and
> therefore not turning them public.
>
> A smarter version of copy clone could be done, but I prefer to go for the
> simplest solution first.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -690,11 +690,17 @@ class localrepository(object):
>
>      def local(self):
>          return self
>
>      def cancopy(self):
> -        return self.local() # so statichttprepo's override of local()
> works
> +        # so statichttprepo's override of local() works
> +        if not self.local():
> +            return False
> +        if not self.ui.configbool('phases', 'publish', True):
> +            return True
> +        # if publishing we can't copy if there is filtered content
> +        return not self.filtered('visible').changelog.filteredrevs
>
>      def join(self, f):
>          return os.path.join(self.path, f)
>
>      def wjoin(self, f):
> diff --git a/tests/test-phases.t b/tests/test-phases.t
> --- a/tests/test-phases.t
> +++ b/tests/test-phases.t
> @@ -505,5 +505,48 @@ test complete failure
>    cannot move 1 changesets to a higher phase, use --force
>    no phases changed
>    [1]
>
>    $ cd ..
> +
> +test hidden changeset are not cloned as public (issue3935)
> +
> +  $ cd initialrepo
> +
> +(enabling evolution)
> +  $ cat > ../obs.py << EOF
> +  > import mercurial.obsolete
> +  > mercurial.obsolete._enabled = True
> +  > EOF
> +  $ echo '[extensions]' >> $HGRCPATH
> +  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
> +
> +(making a changeset hidden; H in that case)
> +  $ hg debugobsolete `hg id --debug -r 5`
> +
> +  $ cd ..
> +  $ hg clone initialrepo clonewithobs
> +  requesting all changes
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 7 changesets with 6 changes to 6 files
> +  updating to branch default
> +  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  $ cd clonewithobs
> +  $ hg log -G --template "{rev} {phase} {desc}\n"
> +  @    6 public merge B' and E
> +  |\
> +  | o  5 public B'
> +  | |
> +  o |  4 public E
> +  | |
> +  o |  3 public D
> +  | |
> +  o |  2 public C
> +  |/
> +  o  1 public B
> +  |
> +  o  0 public A
> +
> +
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Pierre-Yves David - Jan. 30, 2014, 8:47 p.m.
On 01/30/2014 12:40 PM, Augie Fackler wrote:
>
>
>
> On Thu, Jan 30, 2014 at 3:37 PM, Pierre-Yves David
> <pierre-yves.david@ens-lyon.org <mailto:pierre-yves.david@ens-lyon.org>>
> wrote:
>
>     # HG changeset patch
>     # User Pierre-Yves David <pierre-yves.david@logilab.fr
>     <mailto:pierre-yves.david@logilab.fr>>
>     # Date 1391111558 28800
>     #      Thu Jan 30 11:52:38 2014 -0800
>     # Branch stable
>     # Node ID 4cd3a83faa488d6aef4fde615461e6__307fa124de
>     # Parent  427d672c0e4e07642d2400a28946ce__fde11e04ff
>     clone: do not turn hidden changeset public on publishing clone
>     (issue3935)
>
>
> Looks right, but mpm will probably want this without tests for stable?

I don't think so. The other series I send was

Patch 1: fix + test [ACCEPTED]
Patch 2: test only  [REJECTED]

I strongly sugguest accepting fix and patch in the same commit.
Matt Mackall - Jan. 31, 2014, 3:11 a.m.
On Thu, 2014-01-30 at 15:40 -0500, Augie Fackler wrote:
> On Thu, Jan 30, 2014 at 3:37 PM, Pierre-Yves David <
> pierre-yves.david@ens-lyon.org> wrote:
> 
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david@logilab.fr>
> > # Date 1391111558 28800
> > #      Thu Jan 30 11:52:38 2014 -0800
> > # Branch stable
> > # Node ID 4cd3a83faa488d6aef4fde615461e6307fa124de
> > # Parent  427d672c0e4e07642d2400a28946cefde11e04ff
> > clone: do not turn hidden changeset public on publishing clone (issue3935)
> >
> 
> Looks right, but mpm will probably want this without tests for stable?

No, we like tests with our bugfixes. Not very interested in hacking on
_test suite features_ during the freeze though.
Matt Mackall - Jan. 31, 2014, 7:49 a.m.
On Thu, 2014-01-30 at 15:40 -0500, Augie Fackler wrote:
> On Thu, Jan 30, 2014 at 3:37 PM, Pierre-Yves David <
> pierre-yves.david@ens-lyon.org> wrote:
> 
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david@logilab.fr>
> > # Date 1391111558 28800
> > #      Thu Jan 30 11:52:38 2014 -0800
> > # Branch stable
> > # Node ID 4cd3a83faa488d6aef4fde615461e6307fa124de
> > # Parent  427d672c0e4e07642d2400a28946cefde11e04ff
> > clone: do not turn hidden changeset public on publishing clone (issue3935)
> >
> 
> Looks right, but mpm will probably want this without tests for stable?

No, we like tests with our bugfixes. Not very interested in hacking on
_test suite features_ during the freeze though.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -690,11 +690,17 @@  class localrepository(object):

      def local(self):
          return self

      def cancopy(self):
-        return self.local() # so statichttprepo's override of local() works
+        # so statichttprepo's override of local() works
+        if not self.local():
+            return False
+        if not self.ui.configbool('phases', 'publish', True):
+            return True
+        # if publishing we can't copy if there is filtered content
+        return not self.filtered('visible').changelog.filteredrevs

      def join(self, f):
          return os.path.join(self.path, f)

      def wjoin(self, f):
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -505,5 +505,48 @@  test complete failure
    cannot move 1 changesets to a higher phase, use --force
    no phases changed
    [1]

    $ cd ..
+
+test hidden changeset are not cloned as public (issue3935)
+
+  $ cd initialrepo
+
+(enabling evolution)
+  $ cat > ../obs.py << EOF
+  > import mercurial.obsolete
+  > mercurial.obsolete._enabled = True
+  > EOF
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+
+(making a changeset hidden; H in that case)
+  $ hg debugobsolete `hg id --debug -r 5`
+
+  $ cd ..
+  $ hg clone initialrepo clonewithobs
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 7 changesets with 6 changes to 6 files
+  updating to branch default
+  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd clonewithobs
+  $ hg log -G --template "{rev} {phase} {desc}\n"
+  @    6 public merge B' and E
+  |\
+  | o  5 public B'
+  | |
+  o |  4 public E
+  | |
+  o |  3 public D
+  | |
+  o |  2 public C
+  |/
+  o  1 public B
+  |
+  o  0 public A
+
+
+