Mercurial > hg
changeset 7601:49355875c805
merge with crew
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 04 Jan 2009 21:49:37 +0100 |
parents | f7739cf3833c (current diff) 81deb1ba4402 (diff) |
children | d65671beee7f |
files | hgext/convert/cvsps.py hgext/mq.py |
diffstat | 7 files changed, 116 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/cvsps.py Sat Jan 03 17:15:21 2009 +0100 +++ b/hgext/convert/cvsps.py Sun Jan 04 21:49:37 2009 +0100 @@ -191,7 +191,13 @@ ui.note(_("running %s\n") % (' '.join(cmd))) ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root)) - for line in util.popen(' '.join(cmd)): + pfp = util.popen(' '.join(cmd)) + peek = pfp.readline() + while True: + line = peek + if line == '': + break + peek = pfp.readline() if line.endswith('\n'): line = line[:-1] #ui.debug('state=%d line=%r\n' % (state, line)) @@ -312,7 +318,7 @@ e.branches = [tuple([int(y) for y in x.strip().split('.')]) for x in m.group(1).split(';')] state = 8 - elif re_31.match(line): + elif re_31.match(line) and re_50.match(peek): state = 5 store = True elif re_32.match(line):
--- a/hgext/mq.py Sat Jan 03 17:15:21 2009 +0100 +++ b/hgext/mq.py Sun Jan 04 21:49:37 2009 +0100 @@ -1190,17 +1190,16 @@ patchf.write(chunk) try: - copies = {} - for dst in a: - src = repo.dirstate.copied(dst) - # during qfold, the source file for copies may - # be removed. Treat this as a simple add. - if src is not None and src in repo.dirstate: - copies.setdefault(src, []).append(dst) - repo.dirstate.add(dst) - # remember the copies between patchparent and tip - # this may be slow, so don't do it if we're not tracking copies if self.diffopts().git: + copies = {} + for dst in a: + src = repo.dirstate.copied(dst) + # during qfold, the source file for copies may + # be removed. Treat this as a simple add. + if src is not None and src in repo.dirstate: + copies.setdefault(src, []).append(dst) + repo.dirstate.add(dst) + # remember the copies between patchparent and tip for dst in aaa: f = repo.file(dst) src = f.renamed(man[dst]) @@ -1211,9 +1210,15 @@ # we can't copy a file created by the patch itself if dst in copies: del copies[dst] - for src, dsts in copies.iteritems(): - for dst in dsts: - repo.dirstate.copy(src, dst) + for src, dsts in copies.iteritems(): + for dst in dsts: + repo.dirstate.copy(src, dst) + else: + for dst in a: + repo.dirstate.add(dst) + # Drop useless copy information + for f in list(repo.dirstate.copies()): + repo.dirstate.copy(None, f) for f in r: repo.dirstate.remove(f) # if the patch excludes a modified file, mark that
--- a/mercurial/dirstate.py Sat Jan 03 17:15:21 2009 +0100 +++ b/mercurial/dirstate.py Sun Jan 04 21:49:37 2009 +0100 @@ -216,10 +216,15 @@ self._dirty = False def copy(self, source, dest): + """Mark dest as a copy of source. Unmark dest if source is None. + """ if source == dest: return self._dirty = True - self._copymap[dest] = source + if source is not None: + self._copymap[dest] = source + elif dest in self._copymap: + del self._copymap[dest] def copied(self, file): return self._copymap.get(file, None)
--- a/tests/test-convert-cvs-builtincvsps Sat Jan 03 17:15:21 2009 +0100 +++ b/tests/test-convert-cvs-builtincvsps Sun Jan 04 21:49:37 2009 +0100 @@ -100,6 +100,19 @@ hgcat b/c hg -R src-filemap log --template '#rev# #desc# files: #files#\n' +echo % commit a new revision with funny log message +cd src +sleep 1 +echo e >> a +cvscall -q commit -m'funny +---------------------------- +log message' . | grep '<--' |\ + sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' +cd .. + +echo % convert again +hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' + echo "graphlog = " >> $HGRCPATH hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'
--- a/tests/test-convert-cvs-builtincvsps.out Sat Jan 03 17:15:21 2009 +0100 +++ b/tests/test-convert-cvs-builtincvsps.out Sun Jan 04 21:49:37 2009 +0100 @@ -124,6 +124,22 @@ 2 update tags files: .hgtags 1 ci0 files: b/c 0 Initial revision files: b/c +% commit a new revision with funny log message +checking in src/a,v +% convert again +using builtin cvsps +collecting CVS rlog +9 log entries +creating changesets +6 changeset entries +connecting to cvsrepo +scanning source... +sorting... +converting... +0 funny +o 6 (branch) funny +| ---------------------------- +| log message files: a o 5 (branch) ci2 files: b/c | | o 4 () ci1 files: a b/c @@ -138,9 +154,9 @@ % testing debugcvsps collecting CVS rlog -8 log entries +9 log entries creating changesets -5 changeset entries +6 changeset entries --------------------- PatchSet 1 Date: @@ -204,3 +220,17 @@ Members: b/c:1.1->1.1.2.1 +--------------------- +PatchSet 6 +Date: +Author: +Branch: branch +Tag: (none) +Log: +funny +---------------------------- +log message + +Members: + a:1.2->1.2.2.1 +
--- a/tests/test-mq-qrefresh Sat Jan 03 17:15:21 2009 +0100 +++ b/tests/test-mq-qrefresh Sun Jan 04 21:49:37 2009 +0100 @@ -123,15 +123,12 @@ echo cd .. - - -echo "[diff]" >> $HGRCPATH -echo "git=True" >> $HGRCPATH - # Test qrefresh --git losing copy metadata echo % create test repo hg init repo cd repo +echo "[diff]" >> .hg/hgrc +echo "git=True" >> .hg/hgrc echo a > a hg ci -Am adda hg copy a ab @@ -146,3 +143,27 @@ hg qdiff cd .. +# Test issue 1441: qrefresh confused after hg rename +echo % issue1441 without git patches +hg init repo-1441 +cd repo-1441 +echo a > a +hg add a +hg qnew -f p +hg mv a b +hg qrefresh +hg qdiff --nodates +cd .. + +echo % issue1441 with git patches +hg init repo-1441-git +cd repo-1441-git +echo "[diff]" >> .hg/hgrc +echo "git=True" >> .hg/hgrc +echo a > a +hg add a +hg qnew -f p +hg mv a b +hg qrefresh +hg qdiff --nodates +cd .. \ No newline at end of file
--- a/tests/test-mq-qrefresh.out Sat Jan 03 17:15:21 2009 +0100 +++ b/tests/test-mq-qrefresh.out Sun Jan 04 21:49:37 2009 +0100 @@ -253,3 +253,16 @@ @@ -1,1 +1,2 @@ a +c +% issue1441 without git patches +diff -r 000000000000 b +--- /dev/null ++++ b/b +@@ -0,0 +1,1 @@ ++a +% issue1441 with git patches +diff --git a/b b/b +new file mode 100644 +--- /dev/null ++++ b/b +@@ -0,0 +1,1 @@ ++a