Hello community, here is the log from the commit of package hg-git for openSUSE:Factory checked in at 2012-05-16 21:07:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hg-git (Old) and /work/SRC/openSUSE:Factory/.hg-git.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hg-git", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/hg-git/hg-git.changes 2011-10-12 16:12:18.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.hg-git.new/hg-git.changes 2012-05-16 21:07:42.000000000 +0200 @@ -1,0 +2,11 @@ +Wed May 16 10:23:41 UTC 2012 - g...@opensuse.org + +- update to version 0.3.2 + - add support for the HTTP smart protocol when using Dulwich tip + - updated documentation + - support for newer dulwich and hg versions + - allow generating a git repo that has the same "branch names" as + an older hg repo that has named branches, and has had bookmarks + added in to mirror the branch names + +------------------------------------------------------------------- Old: ---- 556c3c586c4a.tar.bz2 New: ---- dfb2b7b5d586.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hg-git.spec ++++++ --- /var/tmp/diff_new_pack.NGIBMH/_old 2012-05-16 21:07:43.000000000 +0200 +++ /var/tmp/diff_new_pack.NGIBMH/_new 2012-05-16 21:07:43.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package hg-git # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,24 +15,25 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -%define rev 556c3c586c4a + +%define rev dfb2b7b5d586 Name: hg-git -Version: 0.3.1 -Release: 1 +Version: 0.3.2 +Release: 0 Summary: Mercurial Plugin for Communicating with Git Servers License: GPL-2.0+ Group: Development/Tools/Version Control -URL: http://hg-git.github.com/ +Url: http://hg-git.github.com/ Source0: https://bitbucket.org/durin42/hg-git/get/%{rev}.tar.bz2 +BuildRequires: mercurial BuildRequires: python-devel -BuildRequires: python-setuptools BuildRequires: python-dulwich >= 0.8.0 -BuildRequires: mercurial +BuildRequires: python-setuptools # tests -BuildRequires: unzip BuildRequires: git-daemon BuildRequires: netcat-openbsd +BuildRequires: unzip Requires: mercurial Requires: python-dulwich >= 0.8.0 BuildArch: noarch @@ -67,3 +68,4 @@ %defattr(-,root,root,-) %doc COPYING DESIGN.txt README.md +%changelog ++++++ 556c3c586c4a.tar.bz2 -> dfb2b7b5d586.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/.hg_archival.txt new/durin42-hg-git-dfb2b7b5d586/.hg_archival.txt --- old/durin42-hg-git-556c3c586c4a/.hg_archival.txt 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/.hg_archival.txt 2012-05-12 10:33:19.000000000 +0200 @@ -1,4 +1,5 @@ repo: 06366111af3c6a2ffa06333ed60d3ed3b9ec0763 -node: 556c3c586c4aa52f587ccc4d2d65b370a7e9037f +node: dfb2b7b5d586e584280c6640652dc939b4b9120a branch: default -tag: 0.3.1 +latesttag: 0.3.2 +latesttagdistance: 14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/.hgtags new/durin42-hg-git-dfb2b7b5d586/.hgtags --- old/durin42-hg-git-556c3c586c4a/.hgtags 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/.hgtags 2012-05-12 10:33:19.000000000 +0200 @@ -7,3 +7,5 @@ bc72dd89c2c911b3b844bd6a1e3841ca16cec59c 0.2.5 46d390f404da3add53c1f8de91216388f791cd82 0.2.6 fa3edeec7ed16dec6a16bd3e99bc3feba93115c3 0.3.0 +556c3c586c4aa52f587ccc4d2d65b370a7e9037f 0.3.1 +a9c0b93488d4d082f813c6d91c8e473505a026c4 0.3.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/Makefile new/durin42-hg-git-dfb2b7b5d586/Makefile --- old/durin42-hg-git-556c3c586c4a/Makefile 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/Makefile 2012-05-12 10:33:19.000000000 +0200 @@ -3,7 +3,7 @@ help: @echo 'Commonly used make targets:' @echo ' tests - run all tests in the automatic test suite' - @echo ' all-version-tests - run all tests against many hg versions' + @echo ' all-version-tests - run all tests against many hg versions' @echo ' tests-%s - run all tests in the specified hg version' all: help diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/README.md new/durin42-hg-git-dfb2b7b5d586/README.md --- old/durin42-hg-git-556c3c586c4a/README.md 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/README.md 2012-05-12 10:33:19.000000000 +0200 @@ -123,11 +123,6 @@ will push your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks. -This is actually pretty cool, since you can use this extension to -transfer your Hg bookmarks via the Git protocol, rather than having to -scp them, as the Hg transfer protocol does not currently support -transferring bookmarks. - Installing ========== @@ -154,3 +149,67 @@ [git] intree = True + +git.authors +----------- + +Git uses a strict convention for "author names" when representing changesets, +using the form `[realname] [email address]`. Mercurial encourages this +convention as well but is not as strict, so it's not uncommon for a Mercurial +repo to have authors listed as simple usernames. hg-git by default will +translate such names using the email address `none@none`, which then shows up +unpleasantly on GitHub as "illegal email address". + +The `git.authors` option provides for an "authors translation file" that will +be used during outgoing transfers from mercurial to git only, by modifying +`hgrc` as such: + + [git] + authors = authors.txt + +Where `authors.txt` is the name of a text file containing author name translations, +one per each line, using the following format: + + johnny = John Smith <jsm...@foo.com> + dougie = Doug Johnson <doug...@bar.com> + +Empty lines and lines starting with a "#" are ignored. + +It should be noted that **this translation is on the hg->git side only**. Changesets +coming from Git back to Mercurial will not translate back into hg usernames, so +it's best that the same username/email combination be used on both the hg and git sides; +the author file is mostly useful for translating legacy changesets. + +git.branch_bookmark_suffix +--------------------------- + +hg-git does not convert between Mercurial named branches and git branches as +the two are conceptually different; instead, it uses Mercurial bookmarks to +represent the concept of a git branch. Therefore, when translating an hg repo +over to git, you typically need to create bookmarks to mirror all the named +branches that you'd like to see transferred over to git. The major caveat with +this is that you can't use the same name for your bookmark as that of the +named branch, and furthermore there's no feasible way to rename a branch in +Mercurial. For the use case where one would like to transfer an hg repo over +to git, and maintain the same named branches as are present on the hg side, +the `branch_bookmark_suffix` might be all that's needed. This presents a +string "suffix" that will be recognized on each bookmark name, and stripped +off as the bookmark is translated to a git branch: + + [git] + branch_bookmark_suffix=_bookmark + +Above, if an hg repo had a named branch called `release_6_maintenance`, you could +then link it to a bookmark called `release_6_maintenance_bookmark`. hg-git will then +strip off the `_bookmark` suffix from this bookmark name, and create a git branch +called `release_6_maintenance`. When pulling back from git to hg, the `_bookmark` +suffix is then applied back, if and only if an hg named branch of that name exists. +E.g., when changes to the `release_6_maintenance` branch are checked into git, these +will be placed into the `release_6_maintenance_bookmark` bookmark on hg. But if a +new branch called `release_7_maintenance` were pulled over to hg, and there was +not a `release_7_maintenance` named branch already, the bookmark will be named +`release_7_maintenance` with no usage of the suffix. + +The `branch_bookmark_suffix` option is, like the `authors` option, intended for +migrating legacy hg named branches. Going forward, an hg repo that is to +be linked with a git repo should only use bookmarks for named branching. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/hggit/__init__.py new/durin42-hg-git-dfb2b7b5d586/hggit/__init__.py --- old/durin42-hg-git-556c3c586c4a/hggit/__init__.py 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/hggit/__init__.py 2012-05-12 10:33:19.000000000 +0200 @@ -37,8 +37,9 @@ # support for `hg clone git://github.com/defunkt/facebox.git` # also hg clone git+ssh://g...@github.com/schacon/simplegit.git -hg.schemes['git'] = gitrepo -hg.schemes['git+ssh'] = gitrepo +_gitschemes = ('git', 'git+ssh', 'git+http', 'git+https') +for _scheme in _gitschemes: + hg.schemes[_scheme] = gitrepo # support for `hg clone localgitrepo` _oldlocal = hg.schemes['file'] @@ -70,7 +71,7 @@ hgdefaultdest = hg.defaultdest def defaultdest(source): - for scheme in ('git', 'git+ssh'): + for scheme in _gitschemes: if source.startswith('%s://' % scheme) and source.endswith('.git'): source = source[:-4] break @@ -130,27 +131,8 @@ kwname = 'onlyheads' def findoutgoing(orig, local, remote, *args, **kwargs): if isinstance(remote, gitrepo.gitrepo): - hgver = hg.util.version() - if hgver >= '1.8.9' or (hgver > '1.8' and '+' in hgver): - raise hgutil.Abort( - 'hg-git outgoing support is broken on hg 1.9.x') - # clean up this cruft when we're 1.7-only, remoteheads and - # the return value change happened between 1.6 and 1.7. - kw = {} - kw.update(kwargs) - for val, k in zip(args, ('base', kwname, 'force')): - kw[k] = val - git = GitHandler(local, local.ui) - base, heads = git.get_refs(remote.path) - newkw = {'base': base, kwname: heads} - newkw.update(kw) - kw = newkw - if kwname == 'heads': - r = orig(local, remote, **kw) - return [x[0] for x in r] - if kwname == 'onlyheads': - del kw['base'] - return orig(local, remote, **kw) + raise hgutil.Abort( + 'hg-git outgoing support is broken') return orig(local, remote, *args, **kwargs) if getattr(discovery, 'findoutgoing', None): extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/hggit/git_handler.py new/durin42-hg-git-dfb2b7b5d586/hggit/git_handler.py --- old/durin42-hg-git-556c3c586c4a/hggit/git_handler.py 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/hggit/git_handler.py 2012-05-12 10:33:19.000000000 +0200 @@ -13,6 +13,11 @@ from mercurial import commands except ImportError: from hgext import bookmarks +try: + from mercurial.error import RepoError +except ImportError: + from mercurial.repo import RepoError + from mercurial.i18n import _ from mercurial.node import hex, bin, nullid from mercurial import context, util as hgutil @@ -75,8 +80,12 @@ else: self.gitdir = self.repo.join('git') + self.init_author_file() + self.paths = ui.configitems('paths') + self.branch_bookmark_suffix = ui.config('git', 'branch_bookmark_suffix') + self.load_map() self.load_tags() @@ -88,6 +97,19 @@ os.mkdir(self.gitdir) self.git = Repo.init_bare(self.gitdir) + def init_author_file(self): + self.author_map = {} + if self.ui.config('git', 'authors'): + with open(self.repo.wjoin( + self.ui.config('git', 'authors') + )) as f: + for line in f: + line = line.strip() + if not line or line.startswith('#'): + continue + from_, to = re.split(r'\s*=\s*', line, 2) + self.author_map[from_] = to + ## FILE LOAD AND SAVE METHODS def map_set(self, gitsha, hgsha): @@ -202,7 +224,7 @@ return {} try: - client.send_pack(path, changed, None) + client.send_pack(path, changed, lambda have, want: []) changed_refs = [ref for ref, sha in new_refs.iteritems() if sha != old_refs.get(ref)] @@ -345,19 +367,66 @@ return commit.id def get_valid_git_username_email(self, name): - return name.lstrip('< ').rstrip('> ') + r"""Sanitize usernames and emails to fit git's restrictions. + + The following is taken from the man page of git's fast-import + command: + + [...] Likewise LF means one (and only one) linefeed [...] + + committer + The committer command indicates who made this commit, + and when they made it. + + Here <name> is the person's display name (for example + "Com M Itter") and <email> is the person's email address + ("c...@example.com[1]"). LT and GT are the literal + less-than (\x3c) and greater-than (\x3e) symbols. These + are required to delimit the email address from the other + fields in the line. Note that <name> and <email> are + free-form and may contain any sequence of bytes, except + LT, GT and LF. <name> is typically UTF-8 encoded. + + Accordingly, this function makes sure that there are none of the + characters <, >, or \n in any string which will be used for + a git username or email. Before this, it first removes left + angle brackets and spaces from the beginning, and right angle + brackets and spaces from the end, of this string, to convert + such things as " <j...@doe.com> " to "j...@doe.com" for + convenience. + + TESTS: + + >>> from mercurial.ui import ui + >>> g = GitHandler('', ui()).get_valid_git_username_email + >>> g('John Doe') + 'John Doe' + >>> g('j...@doe.com') + 'j...@doe.com' + >>> g(' <j...@doe.com> ') + 'j...@doe.com' + >>> g(' <random<\n<garbage\n> > > ') + 'random???garbage?' + >>> g('Typo in hgrc >but.hg-...@handles.it.gracefully>') + 'Typo in hgrc ?but.hg-...@handles.it.gracefully' + """ + return re.sub('[<>\n]', '?', name.lstrip('< ').rstrip('> ')) def get_git_author(self, ctx): # hg authors might not have emails author = ctx.user() + # see if a translation exists + if author in self.author_map: + author = self.author_map[author] + # check for git author pattern compliance regex = re.compile('^(.*?) ?\<(.*?)(?:\>(.*))?$') a = regex.match(author) if a: - name = a.group(1) - email = a.group(2) + name = self.get_valid_git_username_email(a.group(1)) + email = self.get_valid_git_username_email(a.group(2)) if a.group(3) != None and len(a.group(3)) != 0: name += ' ext:(' + urllib.quote(a.group(3)) + ')' author = self.get_valid_git_username_email(name) + ' <' + self.get_valid_git_username_email(email) + '>' @@ -716,7 +785,10 @@ for rev in revs: ctx = self.repo[rev] if getattr(ctx, 'bookmarks', None): - labels = lambda c: ctx.tags() + ctx.bookmarks() + labels = lambda c: ctx.tags() + [ + fltr for fltr, bm + in self._filter_for_bookmarks(ctx.bookmarks()) + ] else: labels = lambda c: ctx.tags() prep = lambda itr: [i.replace(' ', '_') for i in itr] @@ -834,13 +906,25 @@ self.git.refs['refs/tags/' + tag] = self.map_git_get(hex(sha)) self.tags[tag] = hex(sha) + def _filter_for_bookmarks(self, bms): + if not self.branch_bookmark_suffix: + return [(bm, bm) for bm in bms] + else: + def _filter_bm(bm): + if bm.endswith(self.branch_bookmark_suffix): + return bm[0:-(len(self.branch_bookmark_suffix))] + else: + return bm + return [(_filter_bm(bm), bm) for bm in bms] + def local_heads(self): try: if getattr(bookmarks, 'parse', None): bms = bookmarks.parse(self.repo) else: bms = self.repo._bookmarks - return dict([(bm, hex(bms[bm])) for bm in bms]) + return dict([(filtered_bm, hex(bms[bm])) for + filtered_bm, bm in self._filter_for_bookmarks(bms)]) except AttributeError: #pragma: no cover return {} @@ -881,6 +965,7 @@ bms = bookmarks.parse(self.repo) else: bms = self.repo._bookmarks + heads = dict([(ref[11:],refs[ref]) for ref in refs if ref.startswith('refs/heads/')]) @@ -898,6 +983,22 @@ if bm.ancestor(self.repo[hgsha]) == bm: # fast forward bms[head] = hgsha + + # if there's a branch bookmark suffix, + # then add it on to all bookmark names + # that would otherwise conflict with a branch + # name + if self.branch_bookmark_suffix: + real_branch_names = self.repo.branchmap() + bms = dict( + ( + bm_name + self.branch_bookmark_suffix + if bm_name in real_branch_names + else bm_name, + bms[bm_name] + ) + for bm_name in bms + ) if heads: if oldbm: bookmarks.write(self.repo, bms) @@ -964,6 +1065,8 @@ if line == '': continue + if ' : ' not in line: + break command, data = line.split(" : ", 1) if command == 'rename': @@ -1057,37 +1160,39 @@ if not issubclass(client.get_ssh_vendor, _ssh.SSHVendor): client.get_ssh_vendor = _ssh.generate_ssh_vendor(self.ui) - for handler, transport in (("git://", client.TCPGitClient), - ("git@", client.SSHGitClient), - ("git+ssh://", client.SSHGitClient)): - if uri.startswith(handler): - # We need to split around : or /, whatever comes first - hostpath = uri[len(handler):] - if (hostpath.find(':') > 0 and hostpath.find('/') > 0): - # we have both, whatever is first wins. - if hostpath.find(':') < hostpath.find('/'): - hostpath_seper = ':' - else: - hostpath_seper = '/' - elif hostpath.find(':') > 0: - hostpath_seper = ':' - else: - hostpath_seper = '/' - - port = None - host, path = hostpath.split(hostpath_seper, 1) - if hostpath_seper == '/': - transportpath = '/' + path - else: - # port number should be recognized - m = re.match('^(?P<port>\d+)?(?P<path>.*)$', path) - if m.group('port'): - client.port = m.group('port') - port = client.port - transportpath = m.group('path') - else: - transportpath = path + # Test for git:// and git+ssh:// URI. + # Support several URL forms, including separating the + # host and path with either a / or : (sepr) + git_pattern = re.compile( + r'^(?P<scheme>git([+]ssh)?://)(?P<host>.*?)(:(?P<port>\d+))?' + r'(?P<sepr>[:/])(?P<path>.*)$' + ) + git_match = git_pattern.match(uri) + if git_match: + res = git_match.groupdict() + transport = client.SSHGitClient if 'ssh' in res['scheme'] else client.TCPGitClient + host, port, sepr, path = res['host'], res['port'], res['sepr'], res['path'] + if sepr == '/': + path = '/' + path + # strip trailing slash for heroku-style URLs + # ssh+git://g...@heroku.com:project.git/ + if sepr == ':' and path.endswith('.git/'): + path = path.rstrip('/') + if port: + client.port = port + + return transport(host, thin_packs=False, port=port), path + + httpclient = getattr(client, 'HttpGitClient', None) + + if uri.startswith('git+http://') or uri.startswith('git+https://'): + uri = uri[4:] + + if uri.startswith('http://') or uri.startswith('https://'): + if not httpclient: + raise RepoError('git via HTTP requires dulwich 0.8.1 or later') + else: + return client.HttpGitClient(uri, thin_packs=False), uri - return transport(host, thin_packs=False, port=port), transportpath # if its not git or git+ssh, try a local url.. return client.SubprocessGitClient(thin_packs=False), uri diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/hggit/gitrepo.py new/durin42-hg-git-dfb2b7b5d586/hggit/gitrepo.py --- old/durin42-hg-git-556c3c586c4a/hggit/gitrepo.py 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/hggit/gitrepo.py 2012-05-12 10:33:19.000000000 +0200 @@ -15,6 +15,9 @@ self.ui = ui self.path = path + def url(self): + return self.path + def lookup(self, key): if isinstance(key, str): return key diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/setup.py new/durin42-hg-git-dfb2b7b5d586/setup.py --- old/durin42-hg-git-556c3c586c4a/setup.py 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/setup.py 2012-05-12 10:33:19.000000000 +0200 @@ -5,7 +5,7 @@ setup( name='hg-git', - version='0.3.1', + version='0.3.2', author='Scott Chacon', maintainer='Augie Fackler', maintainer_email='duri...@gmail.com', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-conflict-1 new/durin42-hg-git-dfb2b7b5d586/tests/test-conflict-1 --- old/durin42-hg-git-556c3c586c4a/tests/test-conflict-1 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-conflict-1 2012-05-12 10:33:19.000000000 +0200 @@ -27,7 +27,7 @@ echo C > afile hg ci -m "A->C" -hg merge -r1 | sed 's/-C ./-C/' | grep -v 'merging afile' +hg merge -r1 2>&1 | sed 's/-C ./-C/' | egrep -v '^merging afile$' | sed 's/incomplete.*/failed!/' # resolve using first parent echo C > afile hg resolve -m afile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-conflict-2 new/durin42-hg-git-dfb2b7b5d586/tests/test-conflict-2 --- old/durin42-hg-git-556c3c586c4a/tests/test-conflict-2 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-conflict-2 2012-05-12 10:33:19.000000000 +0200 @@ -27,7 +27,7 @@ echo C > afile hg ci -m "A->C" -hg merge -r1 | sed 's/-C ./-C/' | grep -v 'merging afile' +hg merge -r1 2>&1 | sed 's/-C ./-C/' | egrep -v '^merging afile$' | sed 's/incomplete.*/failed!/' # resolve using second parent echo B > afile hg resolve -m afile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-encoding new/durin42-hg-git-dfb2b7b5d586/tests/test-encoding --- old/durin42-hg-git-556c3c586c4a/tests/test-encoding 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-encoding 2012-05-12 10:33:19.000000000 +0200 @@ -60,7 +60,7 @@ hg clone git://localhost/gitrepo hgrepo | grep -v '^updating' cd hgrepo -HGENCODING=utf-8 hg log --graph --debug | grep -v ': *master' +HGENCODING=utf-8 hg log --graph --debug | grep -v ': *master' | grep -v phase: hg gclear hg push git://localhost/gitrepo2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-git-submodules new/durin42-hg-git-dfb2b7b5d586/tests/test-git-submodules --- old/durin42-hg-git-556c3c586c4a/tests/test-git-submodules 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-git-submodules 2012-05-12 10:33:19.000000000 +0200 @@ -26,7 +26,7 @@ { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | sed 's/, 0 deletions(-)//' count=`expr $count + 1` } @@ -58,10 +58,10 @@ git clone ../gitrepo1 . | python -c "$rmpwd" | sed "$clonefilt" | egrep -v '^done\.$' git submodule add ../gitsubrepo subrepo | python -c "$rmpwd" | sed "$clonefilt" | egrep -v '^done\.$' -git commit -m 'add subrepo' +git commit -m 'add subrepo' | sed 's/, 0 deletions(-)//' git rm --cached subrepo git rm .gitmodules -git commit -m 'rm subrepo' +git commit -m 'rm subrepo' | sed 's/, 0 deletions(-)//' | sed 's/, 0 insertions(+)//' cd .. hg clone gitrepo2 hgrepo | grep -v '^updating' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-git-submodules.out new/durin42-hg-git-dfb2b7b5d586/tests/test-git-submodules.out --- old/durin42-hg-git-556c3c586c4a/tests/test-git-submodules.out 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-git-submodules.out 2012-05-12 10:33:19.000000000 +0200 @@ -7,13 +7,13 @@ Initialized empty Git repository in ... [master e42b08b] add subrepo - 2 files changed, 4 insertions(+), 0 deletions(-) + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 subrepo rm 'subrepo' rm '.gitmodules' [master 7e4c934] rm subrepo - 2 files changed, 0 insertions(+), 4 deletions(-) + 2 files changed, 4 deletions(-) delete mode 100644 .gitmodules delete mode 160000 subrepo importing git objects into hg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-git-workflow new/durin42-hg-git-dfb2b7b5d586/tests/test-git-workflow --- old/durin42-hg-git-556c3c586c4a/tests/test-git-workflow 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-git-workflow 2012-05-12 10:33:19.000000000 +0200 @@ -43,7 +43,7 @@ echo alpha > alpha hg add alpha hgcommit -m "add alpha" -hg log --graph --debug +hg log --graph --debug | grep -v phase: cd .. @@ -65,6 +65,6 @@ echo % get things back to hg hg gimport -hg log --graph --debug | grep -v ': *master' +hg log --graph --debug | grep -v ': *master' | grep -v phase: echo % gimport should have updated the bookmarks as well hg bookmarks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-hg-author new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-author --- old/durin42-hg-git-556c3c586c4a/tests/test-hg-author 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-author 2012-05-12 10:33:19.000000000 +0200 @@ -99,6 +99,11 @@ hgcommit -u "test < t...@example.com >" -m 'add eta' hg push +echo theta > theta +hg add theta +hgcommit -u "test >t...@example.com>" -m 'add theta' +hg push + hg log --graph | egrep -v ': *(not-master|master)' cd .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-hg-author.out new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-author.out --- old/durin42-hg-git-556c3c586c4a/tests/test-hg-author.out 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-author.out 2012-05-12 10:33:19.000000000 +0200 @@ -39,9 +39,19 @@ creating and sending data default::refs/heads/not-master => GIT:7eeab2ea default::refs/heads/master => GIT:8c878c97 -@ changeset: 7:b90e988091a2 +pushing to git://localhost/gitrepo +exporting hg objects to git +creating and sending data + default::refs/heads/not-master => GIT:7eeab2ea + default::refs/heads/master => GIT:1e03e913 +@ changeset: 8:d3c51ce68cfd | tag: default/master | tag: tip +| user: test >t...@example.com> +| date: Mon Jan 01 00:00:18 2007 +0000 +| summary: add theta +| +o changeset: 7:b90e988091a2 | user: test < t...@example.com > | date: Mon Jan 01 00:00:17 2007 +0000 | summary: add eta @@ -83,10 +93,15 @@ summary: add alpha importing git objects into hg -7 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 7:8ab87d5066e4 +8 files updated, 0 files merged, 0 files removed, 0 files unresolved +@ changeset: 8:efec0270e295 | tag: default/master | tag: tip +| user: test ?t...@example.com <test ?t...@example.com> +| date: Mon Jan 01 00:00:18 2007 +0000 +| summary: add theta +| +o changeset: 7:8ab87d5066e4 | user: test <t...@example.com> | date: Mon Jan 01 00:00:17 2007 +0000 | summary: add eta @@ -127,6 +142,12 @@ date: Mon Jan 01 00:00:10 2007 +0000 summary: add alpha +commit 1e03e913eca571b86ee06d3c1ddd795dde9ca917 +Author: test ?t...@example.com <test ?t...@example.com> +Date: Mon Jan 1 00:00:18 2007 +0000 + + add theta + commit 8c878c9764e96e67ed9f62b3f317d156bf71bc52 Author: test <t...@example.com> Date: Mon Jan 1 00:00:17 2007 +0000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-hg-branch new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-branch --- old/durin42-hg-git-556c3c586c4a/tests/test-hg-branch 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-hg-branch 2012-05-12 10:33:19.000000000 +0200 @@ -71,7 +71,7 @@ hgcommit -m 'rename alpha to beta' hg push -hg branch gamma +hg branch gamma | grep -v 'permanent and global' hgcommit -m 'started branch gamma' hg push diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-merge new/durin42-hg-git-dfb2b7b5d586/tests/test-merge --- old/durin42-hg-git-556c3c586c4a/tests/test-merge 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-merge 2012-05-12 10:33:19.000000000 +0200 @@ -26,7 +26,7 @@ { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | sed 's/, 0 deletions(-)//' count=`expr $count + 1` } @@ -48,7 +48,7 @@ commit -m 'add gamma' # clean merge -git merge beta +git merge beta | sed "s/the '//;s/' strategy//" | sed 's/^Merge.*recursive.*$/Merge successful/' | sed 's/files/file/;s/insertions/insertion/;s/, 0 deletions.*//' cd .. mkdir gitrepo2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-merge.out new/durin42-hg-git-dfb2b7b5d586/tests/test-merge.out --- old/durin42-hg-git-556c3c586c4a/tests/test-merge.out 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-merge.out 2012-05-12 10:33:19.000000000 +0200 @@ -2,9 +2,9 @@ Switched to a new branch "beta" Switched to branch "master" -Merge made by recursive. +Merge successful beta | 1 + - 1 files changed, 1 insertions(+), 0 deletions(-) + 1 file changed, 1 insertion(+) create mode 100644 beta Initialized empty Git repository in gitrepo2/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-octopus new/durin42-hg-git-dfb2b7b5d586/tests/test-octopus --- old/durin42-hg-git-556c3c586c4a/tests/test-octopus 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-octopus 2012-05-12 10:33:19.000000000 +0200 @@ -26,7 +26,7 @@ { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | sed 's/0 deletions(-)//' count=`expr $count + 1` } @@ -53,7 +53,7 @@ git add delta commit -m 'add delta' -git merge branch1 branch2 +git merge branch1 branch2 | sed "s/the '//;s/' strategy//" | sed 's/^Merge.*octopus.*$/Merge successful/;s/, 0 deletions.*//' cd .. mkdir gitrepo2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-octopus.out new/durin42-hg-git-dfb2b7b5d586/tests/test-octopus.out --- old/durin42-hg-git-556c3c586c4a/tests/test-octopus.out 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-octopus.out 2012-05-12 10:33:19.000000000 +0200 @@ -5,10 +5,10 @@ Switched to branch "master" Trying simple merge with branch1 Trying simple merge with branch2 -Merge made by octopus. +Merge successful beta | 1 + gamma | 1 + - 2 files changed, 2 insertions(+), 0 deletions(-) + 2 files changed, 2 insertions(+) create mode 100644 beta create mode 100644 gamma Initialized empty Git repository in gitrepo2/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-outgoing new/durin42-hg-git-dfb2b7b5d586/tests/test-outgoing --- old/durin42-hg-git-556c3c586c4a/tests/test-outgoing 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-outgoing 2012-05-12 10:33:19.000000000 +0200 @@ -1,5 +1,10 @@ #!/bin/sh +# This feature is currently completely broken due to changes in +# dulwich, but since it was already broken on hg 1.9 and later, it's +# not a blocker. +exit 80 + # Fails for some reason, need to investigate # "$TESTDIR/hghave" git || exit 80 python -c 'from mercurial import util ; assert util.version() < "1.8"' || exit 80 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-url-parsing.py new/durin42-hg-git-dfb2b7b5d586/tests/test-url-parsing.py --- old/durin42-hg-git-556c3c586c4a/tests/test-url-parsing.py 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-url-parsing.py 2012-05-12 10:33:19.000000000 +0200 @@ -29,6 +29,12 @@ self.assertEquals(path, '/webjam/webjam.git') self.assertEquals(client.host, 'g...@github.com') + def test_ssh_github_style_colon_number_starting_username(self): + url = "git+ssh://g...@github.com:42qu/vps.git" + client, path = self.handler.get_transport_and_path(url) + self.assertEquals(path, '42qu/vps.git') + self.assertEquals(client.host, 'g...@github.com') + def test_ssh_github_style_colon(self): url = "git+ssh://g...@github.com:webjam/webjam.git" client, path = self.handler.get_transport_and_path(url) @@ -40,6 +46,26 @@ client, path = self.handler.get_transport_and_path(url) self.assertEquals(path, 'webjam.git') self.assertEquals(client.host, 'g...@heroku.com') + # also test that it works even if heroku isn't in the name + url = "git+ssh://g...@compatible.com:webjam.git" + client, path = self.handler.get_transport_and_path(url) + self.assertEquals(path, 'webjam.git') + self.assertEquals(client.host, 'g...@compatible.com') + + def test_ssh_heroku_style_with_trailing_slash(self): + # some versions of mercurial add a trailing slash even if + # the user didn't supply one. + url = "git+ssh://g...@heroku.com:webjam.git/" + client, path = self.handler.get_transport_and_path(url) + self.assertEquals(path, 'webjam.git') + self.assertEquals(client.host, 'g...@heroku.com') + + def test_heroku_style_with_port(self): + url = "git+ssh://g...@heroku.com:999:webjam.git" + client, path = self.handler.get_transport_and_path(url) + self.assertEquals(path, 'webjam.git') + self.assertEquals(client.host, 'g...@heroku.com') + self.assertEquals(client.port, '999') def test_gitdaemon_style(self): url = "git://github.com/webjam/webjam.git" @@ -69,12 +95,7 @@ if __name__ == '__main__': tc = TestUrlParsing() - for test in ['test_ssh_github_style_slash', - 'test_ssh_github_style_colon', - 'test_ssh_heroku_style', - 'test_gitdaemon_style', - 'test_ssh_github_style_slash_with_port', - 'test_gitdaemon_style_with_port']: + for test in sorted([t for t in dir(tc) if t.startswith('test_')]): tc.setUp() getattr(tc, test)() tc.tearDown() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/durin42-hg-git-556c3c586c4a/tests/test-url-parsing.py.out new/durin42-hg-git-dfb2b7b5d586/tests/test-url-parsing.py.out --- old/durin42-hg-git-556c3c586c4a/tests/test-url-parsing.py.out 2011-09-14 01:16:00.000000000 +0200 +++ new/durin42-hg-git-dfb2b7b5d586/tests/test-url-parsing.py.out 2012-05-12 10:33:19.000000000 +0200 @@ -1,28 +1,46 @@ % expect '/webjam/webjam.git' /webjam/webjam.git -% expect 'g...@github.com' -g...@github.com -% expect 'webjam/webjam.git' -webjam/webjam.git -% expect 'g...@github.com' -g...@github.com +% expect 'github.com' +github.com +% expect '/webjam/webjam.git' +/webjam/webjam.git +% expect 'github.com' +github.com +% expect '19418' +19418 % expect 'webjam.git' webjam.git % expect 'g...@heroku.com' g...@heroku.com +% expect '999' +999 +% expect 'webjam/webjam.git' +webjam/webjam.git +% expect 'g...@github.com' +g...@github.com +% expect '42qu/vps.git' +42qu/vps.git +% expect 'g...@github.com' +g...@github.com % expect '/webjam/webjam.git' /webjam/webjam.git -% expect 'github.com' -github.com +% expect 'g...@github.com' +g...@github.com % expect '/webjam/webjam.git' /webjam/webjam.git % expect 'g...@github.com' g...@github.com % expect '10022' 10022 -% expect '/webjam/webjam.git' -/webjam/webjam.git -% expect 'github.com' -github.com -% expect '19418' -19418 +% expect 'webjam.git' +webjam.git +% expect 'g...@heroku.com' +g...@heroku.com +% expect 'webjam.git' +webjam.git +% expect 'g...@compatible.com' +g...@compatible.com +% expect 'webjam.git' +webjam.git +% expect 'g...@heroku.com' +g...@heroku.com -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org