changeset 4068:5b1f663ef86d

Merge with stable
author Matt Mackall <mpm@selenic.com>
date Tue, 06 Feb 2007 16:12:22 -0600
parents 516f883e3d79 (current diff) c620376b8fd6 (diff)
children 3fef134832d8
files hgext/mq.py mercurial/commands.py mercurial/util.py
diffstat 8 files changed, 135 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Feb 06 15:23:40 2007 -0200
+++ b/hgext/mq.py	Tue Feb 06 16:12:22 2007 -0600
@@ -678,9 +678,10 @@
             while True:
                 seen[n] = 1
                 pp = chlog.parents(n)
-                if pp[1] != revlog.nullid and chlog.rev(pp[1]) > revnum:
-                    if pp[1] not in seen:
-                        heads.append(pp[1])
+                if pp[1] != revlog.nullid:
+                    for p in pp:
+                        if chlog.rev(p) > revnum and p not in seen:
+                            heads.append(p)
                 if pp[0] == revlog.nullid:
                     break
                 if chlog.rev(pp[0]) < revnum:
--- a/mercurial/commands.py	Tue Feb 06 15:23:40 2007 -0200
+++ b/mercurial/commands.py	Tue Feb 06 16:12:22 2007 -0600
@@ -2486,7 +2486,7 @@
     command.
     """
     if os.path.exists(fname):
-        f = open(fname)
+        f = open(fname, "rb")
     else:
         f = urllib.urlopen(fname)
     gen = changegroup.readbundle(f, fname)
@@ -3069,6 +3069,9 @@
         uisetup = getattr(mod, 'uisetup', None)
         if uisetup:
             uisetup(ui)
+        reposetup = getattr(mod, 'reposetup', None)
+        if reposetup:
+            hg.repo_setup_hooks.append(reposetup)
         cmdtable = getattr(mod, 'cmdtable', {})
         overrides = [cmd for cmd in cmdtable if cmd in table]
         if overrides:
@@ -3152,11 +3155,6 @@
                     if not repo:
                         repo = hg.repository(u, path=path)
                     u = repo.ui
-                    for name in external.itervalues():
-                        mod = sys.modules[name]
-                        if hasattr(mod, 'reposetup'):
-                            mod.reposetup(u, repo)
-                            hg.repo_setup_hooks.append(mod.reposetup)
                 except hg.RepoError:
                     if cmd not in optionalrepo.split():
                         raise
--- a/mercurial/util.py	Tue Feb 06 15:23:40 2007 -0200
+++ b/mercurial/util.py	Tue Feb 06 16:12:22 2007 -0600
@@ -579,7 +579,7 @@
         shutil.copyfile(src, dest)
         shutil.copymode(src, dest)
     except shutil.Error, inst:
-        raise util.Abort(str(inst))
+        raise Abort(str(inst))
 
 def copyfiles(src, dst, hardlink=None):
     """Copy a directory tree using hardlinks if possible"""
--- a/mercurial/version.py	Tue Feb 06 15:23:40 2007 -0200
+++ b/mercurial/version.py	Tue Feb 06 16:12:22 2007 -0600
@@ -18,10 +18,13 @@
 unknown_version = 'unknown'
 remembered_version = False
 
-def get_version():
+def get_version(doreload=False):
     """Return version information if available."""
     try:
-        from mercurial.__version__ import version
+        import mercurial.__version__
+        if doreload:
+            reload(mercurial.__version__)
+        version = mercurial.__version__.version
     except ImportError:
         version = unknown_version
     return version
@@ -40,6 +43,8 @@
     f.write("# This file is auto-generated.\n")
     f.write("version = %r\n" % version)
     f.close()
+    # reload the file we've just written
+    get_version(True)
 
 def remember_version(version=None):
     """Store version information."""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extension	Tue Feb 06 16:12:22 2007 -0600
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Test basic extension support
+
+cat > foobar.py <<EOF
+import os
+from mercurial import commands
+
+def uisetup(ui):
+    ui.write("uisetup called\\n")
+
+def reposetup(ui, repo):
+    ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
+
+def foo(ui, *args, **kwargs):
+    ui.write("Foo\\n")
+
+def bar(ui, *args, **kwargs):
+    ui.write("Bar\\n")
+
+cmdtable = {
+    "foo": (foo, [], "hg foo"),
+    "bar": (bar, [], "hg bar"),
+}
+
+commands.norepo += ' bar'
+EOF
+abspath=`pwd`/foobar.py
+
+hg init a
+cd a
+echo foo > file
+hg add file
+hg commit -m 'add file'
+
+echo '[extensions]' >> $HGRCPATH
+echo "foobar = $abspath" >> $HGRCPATH
+hg foo
+
+cd ..
+hg clone a b
+
+hg bar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-extension.out	Tue Feb 06 16:12:22 2007 -0600
@@ -0,0 +1,9 @@
+uisetup called
+reposetup called for a
+Foo
+uisetup called
+reposetup called for a
+reposetup called for b
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+uisetup called
+Bar
--- a/tests/test-mq	Tue Feb 06 15:23:40 2007 -0200
+++ b/tests/test-mq	Tue Feb 06 16:12:22 2007 -0600
@@ -246,3 +246,22 @@
 hg qrefresh --git
 cat .hg/patches/bar
 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
+
+echo '% strip again'
+cd ..
+hg init strip
+cd strip
+touch foo
+hg add foo
+hg ci -m 'add foo' -d '0 0'
+echo >> foo
+hg ci -m 'change foo 1' -d '0 0'
+hg up -C 0
+echo 1 >> foo
+hg ci -m 'change foo 2' -d '0 0'
+HGMERGE=true hg merge
+hg ci -m merge -d '0 0'
+hg log
+hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
+hg log
+
--- a/tests/test-mq.out	Tue Feb 06 15:23:40 2007 -0200
+++ b/tests/test-mq.out	Tue Feb 06 16:12:22 2007 -0600
@@ -264,3 +264,52 @@
 @@ -0,0 +1,1 @@
 +bar
 3 barney (foo)
+% strip again
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+merging foo
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+changeset:   3:99615015637b
+tag:         tip
+parent:      2:20cbbe65cff7
+parent:      1:d2871fc282d4
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     merge
+
+changeset:   2:20cbbe65cff7
+parent:      0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 2
+
+changeset:   1:d2871fc282d4
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 1
+
+changeset:   0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+saving bundle to 
+saving bundle to 
+adding branch
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+(run 'hg update' to get a working copy)
+changeset:   1:20cbbe65cff7
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 2
+
+changeset:   0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+