mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
Merge with main
This commit is contained in:
commit
fba2d48279
@ -203,6 +203,8 @@ class converter_sink(object):
|
||||
"""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()
|
||||
|
||||
|
@ -336,11 +336,14 @@ class converter(object):
|
||||
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:
|
||||
|
@ -189,7 +189,7 @@ class mercurial_sink(converter_sink):
|
||||
|
||||
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 @@ class mercurial_sink(converter_sink):
|
||||
[".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
|
||||
|
@ -32,26 +32,27 @@ def pygmentize(field, fctx, style, tmpl):
|
||||
if util.binary(text):
|
||||
return
|
||||
|
||||
# avoid UnicodeDecodeError in pygments
|
||||
text = encoding.tolocal(text)
|
||||
# Pygments is best used with Unicode strings:
|
||||
# <http://pygments.org/docs/unicode/>
|
||||
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</pre>')]
|
||||
colorized = colorized[colorized.find('<pre>')+5:]
|
||||
coloriter = iter(colorized.splitlines())
|
||||
coloriter = (s.encode(encoding.encoding, 'replace')
|
||||
for s in colorized.splitlines())
|
||||
|
||||
tmpl.filters['colorize'] = lambda x: coloriter.next()
|
||||
|
||||
|
@ -106,13 +106,12 @@ PyDoc_STRVAR(
|
||||
|
||||
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 @@ static PyObject *remove_watch(PyObject *self, PyObject *args)
|
||||
|
||||
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(
|
||||
|
@ -182,7 +182,7 @@ class transplanter(object):
|
||||
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:
|
||||
|
@ -120,7 +120,7 @@ def wrapname(name, wrapper):
|
||||
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
|
||||
|
@ -101,17 +101,20 @@ class hgwebzc(hgweb_mod.hgweb):
|
||||
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
|
||||
|
||||
|
@ -2152,7 +2152,8 @@ def merge(ui, repo, node=None, **opts):
|
||||
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 @@ def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
|
||||
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():
|
||||
|
@ -92,8 +92,6 @@ static PyObject *parse_manifest(PyObject *self, PyObject *args)
|
||||
goto bail;
|
||||
|
||||
if (nlen > 40) {
|
||||
PyObject *flags;
|
||||
|
||||
flags = PyString_FromStringAndSize(zero + 41,
|
||||
nlen - 40);
|
||||
if (!flags)
|
||||
|
@ -17,7 +17,7 @@ def posixfile(name, mode='r', buffering=-1):
|
||||
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):
|
||||
|
@ -18,12 +18,12 @@ marked working directory as branch branch3
|
||||
% 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
|
||||
|
@ -42,7 +42,7 @@ commit -m t3
|
||||
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 @@ commit -a -m 'add foo'
|
||||
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 @@ echo bar > bar
|
||||
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 @@ commit -m 'Octopus merge'
|
||||
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'
|
||||
|
||||
|
64
tests/test-convert-tagsbranch-topology
Executable file
64
tests/test-convert-tagsbranch-topology
Executable file
@ -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
|
19
tests/test-convert-tagsbranch-topology.out
Normal file
19
tests/test-convert-tagsbranch-topology.out
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
@ -121,3 +121,28 @@ rm out
|
||||
|
||||
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 '<div class="parity0 source">' | $TESTDIR/printrepr.py
|
||||
echo % errors encountered
|
||||
cat errors.log
|
||||
}
|
||||
|
||||
hgserveget euc-jp eucjp.txt
|
||||
hgserveget utf-8 eucjp.txt
|
||||
hgserveget us-ascii eucjp.txt
|
||||
|
@ -538,3 +538,16 @@ title="3e1445510fe7: a">test@0</a>
|
||||
/* pygments_style = fruity */
|
||||
|
||||
% errors encountered
|
||||
adding eucjp.txt
|
||||
% HGENCODING=euc-jp hg serve
|
||||
% hgweb filerevision, html
|
||||
<div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div>
|
||||
% errors encountered
|
||||
% HGENCODING=utf-8 hg serve
|
||||
% hgweb filerevision, html
|
||||
<div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div>
|
||||
% errors encountered
|
||||
% HGENCODING=us-ascii hg serve
|
||||
% hgweb filerevision, html
|
||||
<div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div>
|
||||
% errors encountered
|
||||
|
@ -13,11 +13,6 @@ abort: branch 'default' has 3 heads - please merge with an explicit rev
|
||||
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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user