changeset 1171:d14537d7dca9

merge with stable
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 20 Nov 2014 15:34:34 -0800
parents 4697f23e0ede (current diff) 2187f7c88ff6 (diff)
children 8d28bb4fc127
files hgext/evolve.py
diffstat 7 files changed, 233 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/debian/control	Thu Nov 20 15:33:59 2014 -0800
+++ b/debian/control	Thu Nov 20 15:34:34 2014 -0800
@@ -7,7 +7,7 @@
  Pierre-Yves David <pierre-yves.david@logilab.fr>,
 Standards-Version: 3.9.3
 Build-Depends:
- mercurial (>=2.6~),
+ mercurial (>= 3.2~),
  python,
  debhelper (>= 8),
  python-sphinx (>= 1.0.8),
@@ -22,7 +22,7 @@
 Depends:
  ${python:Depends},
  ${misc:Depends},
- mercurial (>= 2.6),
+ mercurial (>= 3.2~),
 Description: evolve extension for Mercurial
  This package provides the experimental "evolve" extension for the Mercurial
  DVCS.
--- a/debian/rules	Thu Nov 20 15:33:59 2014 -0800
+++ b/debian/rules	Thu Nov 20 15:34:34 2014 -0800
@@ -10,7 +10,7 @@
 
 ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
 override_dh_auto_test:
-	cd tests &&  python run-tests.py --with-hg=`which hg`
+	cd tests &&  python run-tests.py --with-hg=`which hg` --blacklist=$(CURDIR)/debian/test-blacklist
 endif
 
 override_dh_python2:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/test-blacklist	Thu Nov 20 15:34:34 2014 -0800
@@ -0,0 +1,3 @@
+test-drop.t
+test-simple4server.t
+tests/test-simple4server-bundle2.t
--- a/hgext/evolve.py	Thu Nov 20 15:33:59 2014 -0800
+++ b/hgext/evolve.py	Thu Nov 20 15:34:34 2014 -0800
@@ -19,7 +19,7 @@
     - improves some aspect of the early implementation in Mercurial core
 '''
 
-__version__ = '5.1.0'
+__version__ = '5.0.0'
 testedwith = '3.2'
 buglink = 'http://bz.selenic.com/'
 
@@ -884,7 +884,7 @@
 def _installimportobsolete(ui):
     entry = cmdutil.findcmd('import', commands.table)[1]
     entry[1].append(('', 'obsolete', False,
-                    _('mark the old node as obsoleted by'
+                    _('mark the old node as obsoleted by '
                       'the created commit')))
 
 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
@@ -1118,7 +1118,7 @@
     ] + mergetoolopts,
     _('[OPTIONS]...'))
 def evolve(ui, repo, **opts):
-    """Solve trouble in your repository
+    """solve trouble in your repository
 
     - rebase unstable changesets to make them stable again,
     - create proper diffs from bumped changesets,
@@ -1584,9 +1584,10 @@
 shorttemplate = '[{rev}] {desc|firstline}\n'
 
 @command('^previous',
-         [],
-         '')
-def cmdprevious(ui, repo):
+         [('B', 'move-bookmark', False,
+             _('Move current active bookmark after update'))],
+         '[-B]')
+def cmdprevious(ui, repo, **opts):
     """update to parent and display summary lines"""
     wkctx = repo[None]
     wparents = wkctx.parents()
@@ -1598,11 +1599,14 @@
     if len(parents) == 1:
         p = parents[0]
         bm = bookmarks.readcurrent(repo)
-        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        shouldmove = opts.get('move_bookmark') and bm is not None
         ret = hg.update(repo, p.rev())
-        if not ret and shouldmove:
-            repo._bookmarks[bm] = p.node()
-            repo._bookmarks.write()
+        if not ret:
+            if shouldmove:
+                repo._bookmarks[bm] = p.node()
+                repo._bookmarks.write()
+            else:
+                bookmarks.unsetcurrent(repo)
         displayer.show(p)
         return 0
     else:
@@ -1612,9 +1616,10 @@
         return 1
 
 @command('^next',
-         [],
-         '')
-def cmdnext(ui, repo):
+         [('B', 'move-bookmark', False,
+             _('Move current active bookmark after update'))],
+         '[-B]')
+def cmdnext(ui, repo, **opts):
     """update to child and display summary lines"""
     wkctx = repo[None]
     wparents = wkctx.parents()
@@ -1629,11 +1634,14 @@
     if len(children) == 1:
         c = children[0]
         bm = bookmarks.readcurrent(repo)
-        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        shouldmove = opts.get('move_bookmark') and bm is not None
         ret = hg.update(repo, c.rev())
-        if not ret and shouldmove:
-            repo._bookmarks[bm] = c.node()
-            repo._bookmarks.write()
+        if not ret:
+            if shouldmove:
+                repo._bookmarks[bm] = c.node()
+                repo._bookmarks.write()
+            else:
+                bookmarks.unsetcurrent(repo)
         displayer.show(c)
         return 0
     else:
@@ -2054,7 +2062,7 @@
     # allow to choose the seed ?
     _('[-r] revs'))
 def touch(ui, repo, *revs, **opts):
-    """Create successors that are identical to their predecessors except for the changeset ID
+    """create successors that are identical to their predecessors except for the changeset ID
 
     This is used to "resurrect" changesets
     """
--- a/tests/test-prev-next.t	Thu Nov 20 15:33:59 2014 -0800
+++ b/tests/test-prev-next.t	Thu Nov 20 15:34:34 2014 -0800
@@ -5,7 +5,7 @@
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
 
-hg prev should move active bookmark
+hg prev -B should move active bookmark
   $ hg init
   $ touch a
   $ hg add a
@@ -16,31 +16,53 @@
   $ hg bookmark mark
   $ hg bookmarks
    * mark                      1:6e742c9127b3
-  $ hg prev
+  $ hg prev -B
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [0] added a
   $ hg bookmarks
    * mark                      0:a154386e50d1
 
+hg next -B should move active bookmark
+  $ hg next -B
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [1] added b
+  $ hg bookmarks
+   * mark                      1:6e742c9127b3
+
+hg prev should unset active bookmark
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [0] added a
+  $ hg bookmarks
+     mark                      1:6e742c9127b3
+
 hg next should move active bookmark
+  $ hg bookmark mark2
+  $ hg bookmarks
+     mark                      1:6e742c9127b3
+   * mark2                     0:a154386e50d1
   $ hg next
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [1] added b
   $ hg bookmarks
-   * mark                      1:6e742c9127b3
+     mark                      1:6e742c9127b3
+     mark2                     0:a154386e50d1
+
+  $ hg bookmark -d mark2
+  $ hg bookmark mark
 
 hg next/prev should not interfere with inactive bookmarks
   $ touch c
   $ hg add c
   $ hg commit -m 'added c'
   $ hg bookmark -r2 no-move
-  $ hg prev
+  $ hg prev -B
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [1] added b
   $ hg bookmarks
    * mark                      1:6e742c9127b3
      no-move                   2:4e26ef31f919
-  $ hg next
+  $ hg next -B
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [2] added c
   $ hg bookmarks
@@ -49,13 +71,13 @@
   $ hg up 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (leaving bookmark mark)
-  $ hg next
+  $ hg next -B
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   [2] added c
   $ hg bookmarks
      mark                      2:4e26ef31f919
      no-move                   2:4e26ef31f919
-  $ hg prev
+  $ hg prev -B
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [1] added b
   $ hg bookmarks
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-simple4server-bundle2.t	Thu Nov 20 15:34:34 2014 -0800
@@ -0,0 +1,171 @@
+
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > amend=-d "0 0"
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [phases]
+  > publish = False
+  > [extensions]
+  > hgext.rebase=
+  > [experimental]
+  > bundle2-exp=True
+  > EOF
+
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+
+setup repo
+
+  $ hg init server
+  $ echo "[extensions]" >> ./server/.hg/hgrc
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/simple4server.py" >> ./server/.hg/hgrc
+  $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg clone http://localhost:$HGPORT/ client
+  no changes found
+  updating to branch default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat ./errors.log
+  $ echo "[extensions]" >> ./client/.hg/hgrc
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> ./client/.hg/hgrc
+  $ cp -r client other
+
+Smoke testing
+===============
+
+  $ cd client
+  $ mkcommit 0
+  $ mkcommit a
+  $ hg push
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 2 changesets with 2 changes to 2 files
+  $ hg pull
+  pulling from http://localhost:$HGPORT/
+  searching for changes
+  no changes found
+  $ cat ../errors.log
+  $ hg pull -R ../other
+  pulling from http://localhost:$HGPORT/
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  (run 'hg update' to get a working copy)
+  $ cat ../errors.log
+  $ hg push -R ../other
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  no changes found
+  [1]
+  $ cat ../errors.log
+
+Capacity testing
+===================
+
+  $ curl --silent http://localhost:$HGPORT/?cmd=hello
+  capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon
+  $ curl --silent http://localhost:$HGPORT/?cmd=capabilities
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon (no-eol)
+
+  $ curl --silent "http://localhost:$HGPORT/?cmd=listkeys&namespace=namespaces" | sort
+  bookmarks	
+  namespaces	
+  obsolete	
+  phases	
+
+Push
+=============
+
+  $ echo 'A' > a
+  $ hg amend
+  $ hg push
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files (+1 heads)
+  remote: 2 new obsolescence markers
+  $ cat ../errors.log
+  $ hg push
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  no changes found
+  [1]
+  $ cat ../errors.log
+
+Pull
+=============
+
+  $ hg -R ../other pull
+  pulling from http://localhost:$HGPORT/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re)
+  2 new obsolescence markers
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ cat ../errors.log
+  $ hg -R ../other pull
+  pulling from http://localhost:$HGPORT/
+  searching for changes
+  no changes found
+  $ cat ../errors.log
+
+  $ cd ..
+
+Test disabling obsolete advertisement
+===========================================
+(used by bitbucket to select which repo use evolve)
+
+  $ curl --silent "http://localhost:$HGPORT/?cmd=listkeys&namespace=namespaces" | sort
+  bookmarks	
+  namespaces	
+  obsolete	
+  phases	
+  $ curl --silent http://localhost:$HGPORT/?cmd=hello
+  capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon
+  $ curl --silent http://localhost:$HGPORT/?cmd=capabilities
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon (no-eol)
+
+  $ echo '[__temporary__]' >> server/.hg/hgrc
+  $ echo 'advertiseobsolete=False' >> server/.hg/hgrc
+  $ $TESTDIR/killdaemons.py
+  $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ curl --silent "http://localhost:$HGPORT/?cmd=listkeys&namespace=namespaces" | sort
+  bookmarks	
+  namespaces	
+  phases	
+  $ curl --silent http://localhost:$HGPORT/?cmd=hello
+  capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
+  $ curl --silent http://localhost:$HGPORT/?cmd=capabilities
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 (no-eol)
+
+  $ echo 'advertiseobsolete=True' >> server/.hg/hgrc
+  $ $TESTDIR/killdaemons.py
+  $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ curl --silent "http://localhost:$HGPORT/?cmd=listkeys&namespace=namespaces" | sort
+  bookmarks	
+  namespaces	
+  obsolete	
+  phases	
+  $ curl --silent http://localhost:$HGPORT/?cmd=hello
+  capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon
+  $ curl --silent http://localhost:$HGPORT/?cmd=capabilities
+  lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream bundle2-exp=HG2Y%0Ab2x%253Achangegroup%3D01%2C02%0Ab2x%253Alistkeys%0Ab2x%253Aobsmarkers%3DV0%2CV1%0Ab2x%253Apushkey%0Ab2x%253Aremote-changegroup%3Dhttp%2Chttps%0Adigests%3Dmd5%2Csha1%2Csha512 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 _evoext_pushobsmarkers_0 _evoext_pullobsmarkers_0 _evoext_obshash_0 _evoext_getbundle_obscommon (no-eol)
--- a/tests/test-stabilize-conflict.t	Thu Nov 20 15:33:59 2014 -0800
+++ b/tests/test-stabilize-conflict.t	Thu Nov 20 15:34:34 2014 -0800
@@ -8,6 +8,7 @@
   > [ui]
   > interactive=false
   > merge=internal:merge
+  > promptecho = True
   > [defaults]
   > amend=-d "0 0"
   > [merge-tools]