# HG changeset patch # User Martin Geisler # Date 1254176581 -7200 # Node ID a23ee0208f7760cd151a8e246f7043e91c811016 # Parent 8d7d68dd91fd6c3552dbe4648a000ffd1d259a67# Parent 3e673c988c85ada261f9f87555c894cf1f429386 Merge with main diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/convert/common.py --- a/hgext/convert/common.py Thu Sep 17 18:12:53 2009 -0400 +++ b/hgext/convert/common.py Tue Sep 29 00:23:01 2009 +0200 @@ -203,6 +203,8 @@ """Put tags into sink. tags: {tagname: sink_rev_id, ...} where tagname is an UTF-8 string. + Return a pair (tag_revision, tag_parent_revision), or (None, None) + if nothing was changed. """ raise NotImplementedError() diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Thu Sep 17 18:12:53 2009 -0400 +++ b/hgext/convert/convcmd.py Tue Sep 29 00:23:01 2009 +0200 @@ -336,11 +336,14 @@ ctags[k] = self.map[v] if c and ctags: - nrev = self.dest.puttags(ctags) - # write another hash correspondence to override the previous - # one so we don't end up with extra tag heads - if nrev: - self.map[c] = nrev + nrev, tagsparent = self.dest.puttags(ctags) + if nrev and tagsparent: + # write another hash correspondence to override the previous + # one so we don't end up with extra tag heads + tagsparents = [e for e in self.map.iteritems() + if e[1] == tagsparent] + if tagsparents: + self.map[tagsparents[0][0]] = nrev self.writeauthormap() finally: diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/convert/hg.py --- a/hgext/convert/hg.py Thu Sep 17 18:12:53 2009 -0400 +++ b/hgext/convert/hg.py Tue Sep 29 00:23:01 2009 +0200 @@ -189,7 +189,7 @@ newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags]) if newlines == oldlines: - return None + return None, None data = "".join(newlines) def getfilectx(repo, memctx, f): return context.memfilectx(f, data, False, False, None) @@ -201,7 +201,7 @@ [".hgtags"], getfilectx, "convert-repo", date, extra) self.repo.commitctx(ctx) - return hex(self.repo.changelog.tip()) + return hex(self.repo.changelog.tip()), hex(tagparent) def setfilemapmode(self, active): self.filemapmode = active diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py Thu Sep 17 18:12:53 2009 -0400 +++ b/hgext/highlight/highlight.py Tue Sep 29 00:23:01 2009 +0200 @@ -32,26 +32,27 @@ if util.binary(text): return - # avoid UnicodeDecodeError in pygments - text = encoding.tolocal(text) + # Pygments is best used with Unicode strings: + # + text = text.decode(encoding.encoding, 'replace') # To get multi-line strings right, we can't format line-by-line try: - lexer = guess_lexer_for_filename(fctx.path(), text[:1024], - encoding=encoding.encoding) + lexer = guess_lexer_for_filename(fctx.path(), text[:1024]) except (ClassNotFound, ValueError): try: - lexer = guess_lexer(text[:1024], encoding=encoding.encoding) + lexer = guess_lexer(text[:1024]) except (ClassNotFound, ValueError): - lexer = TextLexer(encoding=encoding.encoding) + lexer = TextLexer() - formatter = HtmlFormatter(style=style, encoding=encoding.encoding) + formatter = HtmlFormatter(style=style) colorized = highlight(text, lexer, formatter) # strip wrapping div colorized = colorized[:colorized.find('\n')] colorized = colorized[colorized.find('
')+5:]
-    coloriter = iter(colorized.splitlines())
+    coloriter = (s.encode(encoding.encoding, 'replace')
+                 for s in colorized.splitlines())
 
     tmpl.filters['colorize'] = lambda x: coloriter.next()
 
diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/inotify/linux/_inotify.c
--- a/hgext/inotify/linux/_inotify.c	Thu Sep 17 18:12:53 2009 -0400
+++ b/hgext/inotify/linux/_inotify.c	Tue Sep 29 00:23:01 2009 +0200
@@ -106,13 +106,12 @@
 
 static PyObject *remove_watch(PyObject *self, PyObject *args)
 {
-    PyObject *ret = NULL;
     uint32_t wd;
     int fd;
     int r;
 
     if (!PyArg_ParseTuple(args, "iI:remove_watch", &fd, &wd))
-	goto bail;
+	return NULL;
 
     Py_BEGIN_ALLOW_THREADS
     r = inotify_rm_watch(fd, wd);
@@ -120,18 +119,11 @@
 
     if (r == -1) {
 	PyErr_SetFromErrno(PyExc_OSError);
-	goto bail;
+	return NULL;
     }
 
     Py_INCREF(Py_None);
-
-    goto done;
-
-bail:
-    Py_CLEAR(ret);
-
-done:
-    return ret;
+    return Py_None;
 }
 
 PyDoc_STRVAR(
diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/transplant.py
--- a/hgext/transplant.py	Thu Sep 17 18:12:53 2009 -0400
+++ b/hgext/transplant.py	Tue Sep 29 00:23:01 2009 +0200
@@ -182,7 +182,7 @@
         fp.write("# HG changeset patch\n")
         fp.write("# User %s\n" % user)
         fp.write("# Date %d %d\n" % date)
-        fp.write(changelog[4])
+        fp.write(msg + '\n')
         fp.close()
 
         try:
diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/win32mbcs.py
--- a/hgext/win32mbcs.py	Thu Sep 17 18:12:53 2009 -0400
+++ b/hgext/win32mbcs.py	Tue Sep 29 00:23:01 2009 +0200
@@ -120,7 +120,7 @@
 funcs = '''os.path.join os.path.split os.path.splitext
  os.path.splitunc os.path.normpath os.path.normcase os.makedirs
  mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase
- mercurial.util.fspath mercurial.windows.pconvert'''
+ mercurial.util.fspath mercurial.util.pconvert'''
 
 # codec and alias names of sjis and big5 to be faked.
 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
diff -r 8d7d68dd91fd -r a23ee0208f77 hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py	Thu Sep 17 18:12:53 2009 -0400
+++ b/hgext/zeroconf/__init__.py	Tue Sep 29 00:23:01 2009 +0200
@@ -101,17 +101,20 @@
     def __init__(self, repo, name=None):
         super(hgwebzc, self).__init__(repo, name)
         name = self.reponame or os.path.basename(repo.root)
+        path = self.repo.ui.config("web", "prefix", "").strip('/')
         desc = self.repo.ui.config("web", "description", name)
-        publish(name, desc, name, int(repo.ui.config("web", "port", 8000)))
+        publish(name, desc, path, int(repo.ui.config("web", "port", 8000)))
 
 class hgwebdirzc(hgwebdir_mod.hgwebdir):
-    def run(self):
+    def __init__(self, conf, baseui=None):
+        super(hgwebdirzc, self).__init__(conf, baseui)
+        prefix = self.ui.config("web", "prefix", "").strip('/') + '/'
         for r, p in self.repos:
             u = self.ui.copy()
             u.readconfig(os.path.join(p, '.hg', 'hgrc'))
             n = os.path.basename(r)
-            publish(n, "hgweb", p, int(u.config("web", "port", 8000)))
-        return super(hgwebdirzc, self).run()
+            path = (prefix + r).strip('/')
+            publish(n, "hgweb", path, int(u.config("web", "port", 8000)))
 
 # listen
 
diff -r 8d7d68dd91fd -r a23ee0208f77 mercurial/commands.py
--- a/mercurial/commands.py	Thu Sep 17 18:12:53 2009 -0400
+++ b/mercurial/commands.py	Tue Sep 29 00:23:01 2009 +0200
@@ -2152,7 +2152,8 @@
         roots, heads = [common.node()], [p2.node()]
         displayer = cmdutil.show_changeset(ui, repo, opts)
         for node in repo.changelog.nodesbetween(roots=roots, heads=heads)[0]:
-            displayer.show(repo[node])
+            if node not in roots:
+                displayer.show(repo[node])
         return 0
 
     return hg.merge(repo, node, force=opts.get('force'))
@@ -3041,7 +3042,10 @@
     if not rev:
         rev = node
 
-    if not clean and check:
+    if check and clean:
+        raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
+
+    if check:
         # we could use dirty() but we can ignore merge and branch trivia
         c = repo[None]
         if c.modified() or c.added() or c.removed():
diff -r 8d7d68dd91fd -r a23ee0208f77 mercurial/parsers.c
--- a/mercurial/parsers.c	Thu Sep 17 18:12:53 2009 -0400
+++ b/mercurial/parsers.c	Tue Sep 29 00:23:01 2009 +0200
@@ -92,8 +92,6 @@
 			goto bail;
 
 		if (nlen > 40) {
-			PyObject *flags;
-
 			flags = PyString_FromStringAndSize(zero + 41,
 							   nlen - 40);
 			if (!flags)
diff -r 8d7d68dd91fd -r a23ee0208f77 mercurial/windows.py
--- a/mercurial/windows.py	Thu Sep 17 18:12:53 2009 -0400
+++ b/mercurial/windows.py	Tue Sep 29 00:23:01 2009 +0200
@@ -17,7 +17,7 @@
     try:
         return osutil.posixfile(name, mode, buffering)
     except WindowsError, err:
-        raise IOError(err.errno, err.strerror)
+        raise IOError(err.errno, '%s: %s' % (name, err.strerror))
 posixfile.__doc__ = osutil.posixfile.__doc__
 
 class winstdout(object):
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-convert-clonebranches.out
--- a/tests/test-convert-clonebranches.out	Thu Sep 17 18:12:53 2009 -0400
+++ b/tests/test-convert-clonebranches.out	Tue Sep 29 00:23:01 2009 +0200
@@ -18,12 +18,12 @@
 % incremental conversion
 2 c1
 pulling from branch0 into branch1
-2 changesets found
+4 changesets found
 1 c2
 pulling from branch0 into branch2
-2 changesets found
+4 changesets found
 0 c3
 pulling from branch2 into branch3
-3 changesets found
+5 changesets found
 pulling from branch1 into branch3
 1 changesets found
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-convert-git
--- a/tests/test-convert-git	Thu Sep 17 18:12:53 2009 -0400
+++ b/tests/test-convert-git	Tue Sep 29 00:23:01 2009 +0200
@@ -42,7 +42,7 @@
 echo b >> a
 commit -a -m t4.1
 
-git checkout -b other HEAD^ >/dev/null 2>/dev/null
+git checkout -b other HEAD~ >/dev/null 2>/dev/null
 echo c > a
 echo a >> a
 commit -a -m t4.2
@@ -68,7 +68,7 @@
 echo >> foo
 commit -a -m 'change foo'
 
-git checkout -b Bar HEAD^ >/dev/null 2>/dev/null
+git checkout -b Bar HEAD~ >/dev/null 2>/dev/null
 echo quux >> quux
 git add quux
 commit -a -m 'add quux'
@@ -77,7 +77,7 @@
 git add bar
 commit -a -m 'add bar'
 
-git checkout -b Baz HEAD^ >/dev/null 2>/dev/null
+git checkout -b Baz HEAD~ >/dev/null 2>/dev/null
 echo baz > baz
 git add baz
 commit -a -m 'add baz'
@@ -89,7 +89,7 @@
 echo bar >> bar
 commit -a -m 'change bar'
 
-git checkout -b Foo HEAD^ >/dev/null 2>/dev/null
+git checkout -b Foo HEAD~ >/dev/null 2>/dev/null
 echo >> foo
 commit -a -m 'change foo'
 
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-convert-tagsbranch-topology
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-tagsbranch-topology	Tue Sep 29 00:23:01 2009 +0200
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+"$TESTDIR/hghave" git || exit 80
+
+echo "[extensions]" >> $HGRCPATH
+echo "convert=" >> $HGRCPATH
+echo 'hgext.graphlog =' >> $HGRCPATH
+echo '[convert]' >> $HGRCPATH
+echo 'hg.usebranchnames = True' >> $HGRCPATH
+echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
+
+GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
+GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
+GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
+GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
+GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
+GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
+
+count=10
+action()
+{
+    GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
+    GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
+    git "$@" >/dev/null 2>/dev/null || echo "git command error"
+    count=`expr $count + 1`
+}
+
+glog()
+{
+    hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+}
+
+convertrepo()
+{
+    hg convert --datesort git-repo hg-repo
+}
+
+# Build a GIT repo with at least 1 tag
+mkdir git-repo
+cd git-repo
+git init >/dev/null 2>&1
+echo a > a
+git add a
+action commit -m "rev1"
+action tag -m "tag1" tag1
+cd ..
+
+# Do a first conversion
+convertrepo
+
+# Simulate upstream  updates after first conversion
+cd git-repo
+echo b > a
+git add a
+action commit -m "rev2"
+action tag -m "tag2" tag2
+cd ..
+
+# Perform an incremental conversion
+convertrepo
+
+# Print the log
+cd hg-repo
+glog
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-convert-tagsbranch-topology.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-convert-tagsbranch-topology.out	Tue Sep 29 00:23:01 2009 +0200
@@ -0,0 +1,19 @@
+initializing destination hg-repo repository
+scanning source...
+sorting...
+converting...
+0 rev1
+updating tags
+scanning source...
+sorting...
+converting...
+0 rev2
+updating tags
+o  3 "update tags" files: .hgtags
+|
+| o  2 "rev2" files: a
+| |
+o |  1 "update tags" files: .hgtags
+ /
+o  0 "rev1" files: a
+
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-double-merge.out
--- a/tests/test-double-merge.out	Thu Sep 17 18:12:53 2009 -0400
+++ b/tests/test-double-merge.out	Tue Sep 29 00:23:01 2009 +0200
@@ -1,9 +1,4 @@
 created new head
-changeset:   0:310fd17130da
-user:        test
-date:        Mon Jan 12 13:46:40 1970 +0000
-summary:     add foo
-
 changeset:   1:7731dad1c2b9
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-highlight
--- a/tests/test-highlight	Thu Sep 17 18:12:53 2009 -0400
+++ b/tests/test-highlight	Tue Sep 29 00:23:01 2009 +0200
@@ -121,3 +121,28 @@
 
 echo % errors encountered
 cat errors.log
+
+cd ..
+hg init eucjp
+cd eucjp
+
+printf '\265\376\n' >> eucjp.txt  # Japanese kanji "Kyo"
+
+hg ci -Ama
+
+hgserveget () {
+    "$TESTDIR/killdaemons.py"
+    echo % HGENCODING="$1" hg serve
+    HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log
+    cat hg.pid >> $DAEMON_PIDS
+
+    echo % hgweb filerevision, html
+    "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \
+        | grep '
' | $TESTDIR/printrepr.py + echo % errors encountered + cat errors.log +} + +hgserveget euc-jp eucjp.txt +hgserveget utf-8 eucjp.txt +hgserveget us-ascii eucjp.txt diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-highlight.out --- a/tests/test-highlight.out Thu Sep 17 18:12:53 2009 -0400 +++ b/tests/test-highlight.out Tue Sep 29 00:23:01 2009 +0200 @@ -538,3 +538,16 @@ /* pygments_style = fruity */ % errors encountered +adding eucjp.txt +% HGENCODING=euc-jp hg serve +% hgweb filerevision, html +
1 \xb5\xfe
+% errors encountered +% HGENCODING=utf-8 hg serve +% hgweb filerevision, html +
1 \xef\xbf\xbd\xef\xbf\xbd
+% errors encountered +% HGENCODING=us-ascii hg serve +% hgweb filerevision, html +
1 ??
+% errors encountered diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-merge-default.out --- a/tests/test-merge-default.out Thu Sep 17 18:12:53 2009 -0400 +++ b/tests/test-merge-default.out Tue Sep 29 00:23:01 2009 +0200 @@ -13,11 +13,6 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) % should succeed - 2 heads -changeset: 1:ba677d0156c1 -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: b - changeset: 3:903c264cdf57 parent: 1:ba677d0156c1 user: test diff -r 8d7d68dd91fd -r a23ee0208f77 tests/test-merge1.out --- a/tests/test-merge1.out Thu Sep 17 18:12:53 2009 -0400 +++ b/tests/test-merge1.out Tue Sep 29 00:23:01 2009 +0200 @@ -1,11 +1,6 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved created new head %% no merges expected -changeset: 0:98e00378acd0 -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: commit #0 - changeset: 1:4ee19afe4659 user: test date: Mon Jan 12 13:46:40 1970 +0000