mirror of
				https://github.com/mnauw/git-remote-hg.git
				synced 2025-10-31 16:45:48 +01:00 
			
		
		
		
	Compare commits
	
		
			161 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 16b33919e4 | ||
|  | 9813797360 | ||
|  | e1a9c3e91b | ||
|  | a8f6d92613 | ||
|  | 4b8a307400 | ||
|  | 6d75435eab | ||
|  | d47a4abdae | ||
|  | afdb8943ea | ||
|  | dc1be060d1 | ||
|  | 13781788eb | ||
|  | 5061e6a322 | ||
|  | 587099b968 | ||
|  | b5f104364f | ||
|  | a48d4fd7fb | ||
|  | 301552278a | ||
|  | fddbbfe990 | ||
|  | c329c9690a | ||
|  | 6c36268028 | ||
|  | 893dd9434f | ||
|  | 4ddbfeb9c8 | ||
|  | 93271a4e1b | ||
|  | 36706dffe6 | ||
|  | da532bf6f4 | ||
|  | aa1d0bc152 | ||
|  | bdbe62256a | ||
|  | 8acf139e44 | ||
|  | 1df692295c | ||
|  | 027e1a16f0 | ||
|  | 723e6c76fc | ||
|  | 2529c986c2 | ||
|  | ab398ade1d | ||
|  | e1d25cf97c | ||
|  | 0fe1e359ec | ||
|  | 498c615051 | ||
|  | 6b6aa9deaa | ||
|  | 2685f56c7c | ||
|  | 3314ce3dda | ||
|  | 408333afca | ||
|  | c861db6add | ||
|  | d2a3a646af | ||
|  | f00911668a | ||
|  | 474cacd81d | ||
|  | e4d87d5e2c | ||
|  | 615cc7fe04 | ||
|  | 79e75991ab | ||
|  | b029ac0500 | ||
|  | 7713b7ecef | ||
|  | b274b8057e | ||
|  | 451e31022a | ||
|  | 9c61c09ebf | ||
|  | 463f397ba4 | ||
|  | e774ad2d96 | ||
|  | 086ca23507 | ||
|  | 7c373be665 | ||
|  | 3bfec5fc6f | ||
|  | 7908c70efb | ||
|  | 7cff2c6adb | ||
|  | 9c5b8835f4 | ||
|  | 537e5a4735 | ||
|  | 8025945a62 | ||
|  | 33dccdfab0 | ||
|  | 4ad9c8d70c | ||
|  | 740c681c1d | ||
|  | 995179444c | ||
|  | e6c479c136 | ||
|  | b8b9a2f571 | ||
|  | 4c50223dba | ||
|  | 35d32d5a75 | ||
|  | 7f6a843f0d | ||
|  | 63cf2780ba | ||
|  | f032d3617b | ||
|  | 60a1d7ae7a | ||
|  | 10aec96d88 | ||
|  | 9b54c626bc | ||
|  | d51f508916 | ||
|  | 9916fead46 | ||
|  | 09c4726083 | ||
|  | bb663c032f | ||
|  | b590aec106 | ||
|  | 4496af4a5c | ||
|  | 890080673b | ||
|  | 5e6ef0a1d5 | ||
|  | a1e2c4acc9 | ||
|  | 7196dac02d | ||
|  | a8bb2a28a3 | ||
|  | ffcb41cc52 | ||
|  | 9949745533 | ||
|  | 83620648ab | ||
|  | 30a2d61bdf | ||
|  | 2fdb786fc4 | ||
|  | 79797918ff | ||
|  | d45d5cde50 | ||
|  | 7078666c77 | ||
|  | 08e453f8db | ||
|  | ec7119d0ef | ||
|  | 6ae5e3961e | ||
|  | b4c3277f72 | ||
|  | de9bf35388 | ||
|  | 857d68708b | ||
|  | 7394fc890e | ||
|  | 22229dd738 | ||
|  | 5cd03ad0fd | ||
|  | bf7ad934d7 | ||
|  | 426ed618b2 | ||
|  | 5f34d049b9 | ||
|  | ea7e9bf31a | ||
|  | a3a36883c5 | ||
|  | 0fdd28319a | ||
|  | a5bc03d4d6 | ||
|  | 104e8895d6 | ||
|  | 30f31c13ce | ||
|  | 485806e1e3 | ||
|  | 6e13c1c818 | ||
|  | ce38d52ce5 | ||
|  | 6b8ee2f1b6 | ||
|  | b3b9b5de39 | ||
|  | 34ba087896 | ||
|  | 4aec2fe3cc | ||
|  | e892cb6ce3 | ||
|  | 59ad50c6d0 | ||
|  | b8c8b1fd00 | ||
|  | 0cf8b2c20a | ||
|  | 8c3cde6be7 | ||
|  | ccee8909ff | ||
|  | dd6b72df21 | ||
|  | 01d619ad3c | ||
|  | 9d45e70fce | ||
|  | 055cec1aa7 | ||
|  | 7d50fa42c1 | ||
|  | f6676e6d86 | ||
|  | cac075744d | ||
|  | 19633eaf36 | ||
|  | 900a55e974 | ||
|  | d1f60c445e | ||
|  | bd3f404d34 | ||
|  | dcf96f31db | ||
|  | 795b88e16c | ||
|  | 20366b4b20 | ||
|  | 1f5134062e | ||
|  | 2313dc2ca0 | ||
|  | 0e52a6c883 | ||
|  | e24a713dc9 | ||
|  | 122b7f5da2 | ||
|  | 98c1c9263e | ||
|  | 85293dcf69 | ||
|  | 970883c46c | ||
|  | ad77f125b7 | ||
|  | 5dcd6df3c8 | ||
|  | ed80437db4 | ||
|  | 0a1e8ecbc7 | ||
|  | 6d6504d1fd | ||
|  | 237ff083af | ||
|  | 0c8f8571c7 | ||
|  | 1442c29d39 | ||
|  | dfa3ad5fca | ||
|  | ebd5bdb111 | ||
|  | 00ac711fb2 | ||
|  | aadc899982 | ||
|  | 4d38bff053 | ||
|  | a8cd6a92b3 | ||
|  | a08ad9d2b4 | 
							
								
								
									
										27
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | name: CI | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   # push: | ||||||
|  |   # save cycles; disable on push, enable manual trigger | ||||||
|  |   workflow_dispatch: | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   test: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     strategy: | ||||||
|  |       matrix: | ||||||
|  |         hg: [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', '6.7', '6.8', '6.9' ] | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v3 | ||||||
|  |       - uses: actions/setup-python@v4 | ||||||
|  |         with: | ||||||
|  |           python-version: '3.10' | ||||||
|  |       - uses: actions/cache@v3 | ||||||
|  |         id: cache-pip | ||||||
|  |         with: | ||||||
|  |           path: ~/.cache/pip | ||||||
|  |           key: pip | ||||||
|  |       - name: Install hg | ||||||
|  |         run: | ||||||
|  |           pip install mercurial==${{ matrix.hg }} | ||||||
|  |       - run: make test | ||||||
							
								
								
									
										20
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,20 +0,0 @@ | |||||||
| dist: xenial |  | ||||||
| language: minimal |  | ||||||
|  |  | ||||||
| cache: |  | ||||||
|   directories: |  | ||||||
|     - $HOME/.cache/git-remote-hg |  | ||||||
|  |  | ||||||
| script: |  | ||||||
|   - ./tools/check-versions hg:$HG_VERSION |  | ||||||
|  |  | ||||||
| matrix: |  | ||||||
|   include: |  | ||||||
|     - env: |  | ||||||
|     - env: HG_VERSION=@ |  | ||||||
|     - env: HG_VERSION=5.0 |  | ||||||
|     - env: HG_VERSION=4.9 |  | ||||||
|     - env: HG_VERSION=4.8 |  | ||||||
|     - env: HG_VERSION=4.7 |  | ||||||
|     - env: HG_VERSION=4.6 |  | ||||||
|     - env: HG_VERSION=4.5 |  | ||||||
							
								
								
									
										8
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Makefile
									
									
									
									
									
								
							| @@ -14,9 +14,9 @@ build: | |||||||
| 		PYTHON=python2 ; \ | 		PYTHON=python2 ; \ | ||||||
| 	elif python -c 'import mercurial' 2> /dev/null ; then \ | 	elif python -c 'import mercurial' 2> /dev/null ; then \ | ||||||
| 		PYTHON=python ; \ | 		PYTHON=python ; \ | ||||||
| 	fi ; \ | 	else \ | ||||||
| 	if [ -n "$$PYTHON" ] ; then \ | 		echo 'Python with Mercurial not available' >&2 ; \ | ||||||
| 		PYTHON=python ; \ | 		exit 1 ; \ | ||||||
| 	fi ; \ | 	fi ; \ | ||||||
| 	mkdir -p bin ; \ | 	mkdir -p bin ; \ | ||||||
| 	for s in git-remote-hg git-hg-helper ; do \ | 	for s in git-remote-hg git-hg-helper ; do \ | ||||||
| @@ -32,7 +32,7 @@ test: | |||||||
| 	$(MAKE) -C test | 	$(MAKE) -C test | ||||||
|  |  | ||||||
| doc/git-remote-hg.1: doc/git-remote-hg.txt | doc/git-remote-hg.1: doc/git-remote-hg.txt | ||||||
| 	a2x -d manpage -f manpage $< | 	asciidoctor -d manpage -b manpage $< | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	$(RM) doc/git-remote-hg.1 | 	$(RM) doc/git-remote-hg.1 | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| 'git-remote-hg' is the semi-official Mercurial bridge from Git project, once | `git-remote-hg` is the semi-official Mercurial bridge from the Git project, once | ||||||
| installed, it allows you to clone, fetch and push to and from Mercurial | installed, it allows you to clone, fetch and push to and from Mercurial | ||||||
| repositories as if they were Git ones: | repositories as if they were Git ones: | ||||||
|  |  | ||||||
| @@ -6,10 +6,10 @@ repositories as if they were Git ones: | |||||||
| git clone "hg::http://selenic.com/repo/hello" | git clone "hg::http://selenic.com/repo/hello" | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| To enable this, simply add the 'git-remote-hg' script anywhere in your `$PATH`: | To enable this, simply add the `git-remote-hg` script anywhere in your `$PATH`: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| wget https://raw.github.com/mnauw/git-remote-hg/master/git-remote-hg -O ~/bin/git-remote-hg | wget https://raw.githubusercontent.com/mnauw/git-remote-hg/master/git-remote-hg -O ~/bin/git-remote-hg | ||||||
| chmod +x ~/bin/git-remote-hg | chmod +x ~/bin/git-remote-hg | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| @@ -49,7 +49,8 @@ If you want to see Mercurial revisions as Git commit notes: | |||||||
| % git config core.notesRef refs/notes/hg | % git config core.notesRef refs/notes/hg | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| If you are not interested in Mercurial permanent and global branches (aka. commit labels): | If you are not interested in Mercurial permanent and global branches (aka. | ||||||
|  | commit labels): | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git config --global remote-hg.track-branches false | % git config --global remote-hg.track-branches false | ||||||
| @@ -57,29 +58,47 @@ If you are not interested in Mercurial permanent and global branches (aka. commi | |||||||
|  |  | ||||||
| With this configuration, the 'branches/foo' refs won't appear. | With this configuration, the 'branches/foo' refs won't appear. | ||||||
|  |  | ||||||
| If you want the equivalent of 'hg clone --insecure': | If you want the equivalent of `hg clone --insecure`: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git config --global remote-hg.insecure true | % git config --global remote-hg.insecure true | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| If you want 'git-remote-hg' to be compatible with 'hg-git', and generate exactly the same commits: | If you want `git-remote-hg` to be compatible with `hg-git`, and generate exactly | ||||||
|  | the same commits: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git config --global remote-hg.hg-git-compat true | % git config --global remote-hg.hg-git-compat true | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
|  | **** | ||||||
|  | mnauw's note; The above is not quite the case, it only ever has been (somewhat) | ||||||
|  | if an undocumented debug mode (`debugextrainmessage` setting) was enabled | ||||||
|  | in (likely somewhat patched) `hg-git`.  And as of `hg-git` v1.2.0 the latter is | ||||||
|  | no longer considered.  In fact, `hg-git` creates git commits with additional hg | ||||||
|  | metadata stored in so-called "extra commit headers". The latter might be seen by | ||||||
|  | `git log --format=raw` or `git cat-file -p <commitid>`, but are otherwise mostly | ||||||
|  | only used internally by the git suite (for signatures).  While they are supported | ||||||
|  | by `dulwich`'s API (which is a python git implementation), there is, however, | ||||||
|  | limited to no support for those in git "porcelain or plumbing" commands. In | ||||||
|  | particular, `git fast-export` and `git fast-import` do not consider these, so a | ||||||
|  | `gitremote-helpers` tool is then also out of luck.  Incidentally, it also | ||||||
|  | follows that a `git fast-export | git fast-import` "clone" approach would also | ||||||
|  | lose such extra metadata, and likewise so for e.g. `git filter-repo`. | ||||||
|  |  | ||||||
|  | All in all, this mode is not quite recommended. | ||||||
|  | If the concern here is not so much `hg-git` compatibility but rather "hg-git-hg | ||||||
|  | round-trip fidelity", then see the discussion below on `check-hg-commits` setting. | ||||||
|  | **** | ||||||
|  |  | ||||||
| == Notes == | == Notes == | ||||||
|  |  | ||||||
| Remember to run `git gc --aggressive` after cloning a repository, specially if | Remember to run `git gc --aggressive` after cloning a repository, especially if | ||||||
| it's a big one. Otherwise lots of space will be wasted. | it's a big one. Otherwise lots of space will be wasted. | ||||||
|  |  | ||||||
| The oldest version of mercurial supported is 1.9. For the most part 1.8 works, |  | ||||||
| but you might experience some issues. |  | ||||||
|  |  | ||||||
| === Pushing branches === | === Pushing branches === | ||||||
|  |  | ||||||
| To push a branch, you need to use the "branches/" prefix: | To push a branch, you need to use the 'branches/' prefix: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git checkout branches/next | % git checkout branches/next | ||||||
| @@ -89,7 +108,7 @@ To push a branch, you need to use the "branches/" prefix: | |||||||
|  |  | ||||||
| All the pushed commits will receive the "next" Mercurial named branch. | All the pushed commits will receive the "next" Mercurial named branch. | ||||||
|  |  | ||||||
| *Note*: Make sure you don't have +remote-hg.track-branches+ disabled. | *Note*: Make sure you don't have `remote-hg.track-branches` disabled. | ||||||
|  |  | ||||||
| === Cloning HTTPS === | === Cloning HTTPS === | ||||||
|  |  | ||||||
| @@ -99,7 +118,7 @@ The simplest way is to specify the user and password in the URL: | |||||||
| git clone hg::https://user:password@bitbucket.org/user/repo | git clone hg::https://user:password@bitbucket.org/user/repo | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| You can also use the http://mercurial.selenic.com/wiki/SchemesExtension[schemes extension]: | You can also use the https://mercurial-scm.org/wiki/SchemesExtension[schemes extension]: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| [auth] | [auth] | ||||||
| @@ -109,11 +128,7 @@ bb.password = password | |||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| Finally, you can also use the | Finally, you can also use the | ||||||
| https://pypi.python.org/pypi/mercurial_keyring[keyring extension]. | https://pypi.org/project/mercurial_keyring[keyring extension]. | ||||||
|  |  | ||||||
| However, some of these features require very new versions of 'git-remote-hg', |  | ||||||
| so you might have better luck simply specifying the username and password in |  | ||||||
| the URL. |  | ||||||
|  |  | ||||||
| === Submodules === | === Submodules === | ||||||
|  |  | ||||||
| @@ -141,10 +156,10 @@ Mercurial branches and bookmarks have some limitations of Git branches: you | |||||||
| can't have both 'dev/feature' and 'dev' (as Git uses files and directories to | can't have both 'dev/feature' and 'dev' (as Git uses files and directories to | ||||||
| store them). | store them). | ||||||
|  |  | ||||||
| Multiple anonymous heads (which are useless anyway) are not supported; you | Multiple anonymous heads (which are useless anyway) are not supported: you | ||||||
| would only see the latest head. | would only see the latest head. | ||||||
|  |  | ||||||
| Closed branches are not supported; they are not shown and you can't close or | Closed branches are not supported: they are not shown and you can't close or | ||||||
| reopen. Additionally in certain rare situations a synchronization issue can | reopen. Additionally in certain rare situations a synchronization issue can | ||||||
| occur (https://github.com/felipec/git/issues/65[Bug #65]). | occur (https://github.com/felipec/git/issues/65[Bug #65]). | ||||||
|  |  | ||||||
| @@ -170,16 +185,27 @@ below for more details. | |||||||
|  |  | ||||||
| == Other projects == | == Other projects == | ||||||
|  |  | ||||||
| There are other 'git-remote-hg' projects out there, do not confuse this one, | There are other `git-remote-hg` projects out there, but this is the original, | ||||||
| this is the one distributed officially by the Git project | which was distributed officially in the Git project. | ||||||
| (_though actually no longer so nowadays_): |  | ||||||
|  |  | ||||||
| * https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg[msysgit's git-remote-hg] | Over the years many similar tools have died out, the only actively maintained | ||||||
| * https://github.com/rfk/git-remote-hg[rfk's git-remote-hg] | alternative is mnauw's fork of this project: | ||||||
|  | https://github.com/mnauw/git-remote-hg[mnauw/git-remote-hg]. I've merged some of | ||||||
|  | his patches, and he has merged some of my patches, so the projects are mostly in | ||||||
|  | sync, but not quite. In particular Nauwelaerts' fork has many administrative | ||||||
|  | extensions, which although useful to some people, I don't believe they belong | ||||||
|  | in the core. | ||||||
|  |  | ||||||
| For a comparison between these and other projects go | For a comparison between these and other projects go | ||||||
| https://github.com/felipec/git/wiki/Comparison-of-git-remote-hg-alternatives[here]. | https://github.com/felipec/git/wiki/Comparison-of-git-remote-hg-alternatives[here]. | ||||||
|  |  | ||||||
|  | **** | ||||||
|  | mnauw's note; I do not know what "the core" means? | ||||||
|  | However, the "extensions" provide useful and possibly | ||||||
|  | critical maintenance wrt git-remote-hg's internal data, so it belongs as close | ||||||
|  | to the latter one as possible. | ||||||
|  | **** | ||||||
|  |  | ||||||
| [[no-limitations]] | [[no-limitations]] | ||||||
| == Limitations (or not) == | == Limitations (or not) == | ||||||
|  |  | ||||||
| @@ -361,7 +387,8 @@ up elsewhere as expected (regardless of conversion mapping or ABI). | |||||||
|  |  | ||||||
| Note that identifying and re-using the hg changeset relies on metadata | Note that identifying and re-using the hg changeset relies on metadata | ||||||
| (`refs/notes/hg` and marks files) that is not managed or maintained by any | (`refs/notes/hg` and marks files) that is not managed or maintained by any | ||||||
| git-to-git fetch (or clone). | git-to-git fetch (or clone) (as that is only automatically so for `refs/heads/`, | ||||||
|  | though it could be pushed manually). | ||||||
| As such (and as said), this approach aims for plain-and-simple safety, but only | As such (and as said), this approach aims for plain-and-simple safety, but only | ||||||
| within a local scope (git repo). | within a local scope (git repo). | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,7 +38,8 @@ If you want to see Mercurial revisions as Git commit notes: | |||||||
| % git config core.notesRef refs/notes/hg | % git config core.notesRef refs/notes/hg | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| If you are not interested in Mercurial permanent and global branches (aka. commit labels): | If you are not interested in Mercurial permanent and global branches (aka. | ||||||
|  | commit labels): | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git config --global remote-hg.track-branches false | % git config --global remote-hg.track-branches false | ||||||
| @@ -52,7 +53,8 @@ If you want the equivalent of `hg clone --insecure`: | |||||||
| % git config --global remote-hg.insecure true | % git config --global remote-hg.insecure true | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| If you want 'git-remote-hg' to be compatible with 'hg-git', and generate exactly the same commits: | If you want 'git-remote-hg' to be compatible with 'hg-git', and generate exactly | ||||||
|  | the same commits: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git config --global remote-hg.hg-git-compat true | % git config --global remote-hg.hg-git-compat true | ||||||
| @@ -102,19 +104,32 @@ the invalid '~' | |||||||
| % git config --global remote-hg.ignore-name ~ | % git config --global remote-hg.ignore-name ~ | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
|  | Even though the "gitdir" is configurable (using `GIT_DIR`), git does not accept | ||||||
|  | certain pathname components, e.g. `.git` or `.gitmodules` (case-insensitive). | ||||||
|  | Problems arise if the hg repo contains such pathnames, and recent git versions | ||||||
|  | will reject this in a very hard way.  So these pathnames are now mapped | ||||||
|  | from "hg space" to "git space" in a one-to-one way, where (e.g.) | ||||||
|  | `.git[0 or more suffix]` is mapped to `.git[1 or more suffix]` (obviously by | ||||||
|  | appending or removing a suffix). The "suffix" in question defaults to `_`, | ||||||
|  | but can be configured using | ||||||
|  |  | ||||||
|  | -------------------------------------- | ||||||
|  | % git config --global remote-hg.dotfile-suffix _ | ||||||
|  | -------------------------------------- | ||||||
|  |  | ||||||
|  |  | ||||||
| NOTES | NOTES | ||||||
| ----- | ----- | ||||||
|  |  | ||||||
| Remember to run `git gc --aggressive` after cloning a repository, specially if | Remember to run `git gc --aggressive` after cloning a repository, especially if | ||||||
| it's a big one. Otherwise lots of space will be wasted. | it's a big one. Otherwise lots of space will be wasted. | ||||||
|  |  | ||||||
| The oldest version of Mercurial supported is 1.9. For the most part 1.8 works, | The newest supported version of Mercurial is 6.2, the oldest one is 2.4. | ||||||
| but you might experience some issues. |  | ||||||
|  |  | ||||||
| Pushing branches | Pushing branches | ||||||
| ~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~ | ||||||
|  |  | ||||||
| To push a Mercurial named branch, you need to use the "branches/" prefix: | To push a branch, you need to use the "branches/" prefix: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| % git checkout branches/next | % git checkout branches/next | ||||||
| @@ -135,7 +150,7 @@ The simplest way is to specify the user and password in the URL: | |||||||
| git clone hg::https://user:password@bitbucket.org/user/repo | git clone hg::https://user:password@bitbucket.org/user/repo | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| You can also use the http://mercurial.selenic.com/wiki/SchemesExtension[schemes extension]: | You can also use the https://mercurial-scm.org/wiki/SchemesExtension[schemes extension]: | ||||||
|  |  | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| [auth] | [auth] | ||||||
| @@ -145,7 +160,7 @@ bb.password = password | |||||||
| -------------------------------------- | -------------------------------------- | ||||||
|  |  | ||||||
| Finally, you can also use the | Finally, you can also use the | ||||||
| https://pypi.python.org/pypi/mercurial_keyring[keyring extension]. | https://pypi.org/project/mercurial_keyring[keyring extension]. | ||||||
|  |  | ||||||
| CAVEATS | CAVEATS | ||||||
| ------- | ------- | ||||||
| @@ -157,10 +172,10 @@ Mercurial branches and bookmarks have some limitations of Git branches: you | |||||||
| can't have both 'dev/feature' and 'dev' (as Git uses files and directories to | can't have both 'dev/feature' and 'dev' (as Git uses files and directories to | ||||||
| store them). | store them). | ||||||
|  |  | ||||||
| Multiple anonymous heads (which are useless anyway) are not supported; you | Multiple anonymous heads (which are useless anyway) are not supported: you | ||||||
| would only see the latest head. | would only see the latest head. | ||||||
|  |  | ||||||
| Closed branches are not supported; they are not shown and you can't close or | Closed branches are not supported: they are not shown and you can't close or | ||||||
| reopen. Additionally in certain rare situations a synchronization issue can | reopen. Additionally in certain rare situations a synchronization issue can | ||||||
| occur (https://github.com/felipec/git/issues/65[Bug #65]). | occur (https://github.com/felipec/git/issues/65[Bug #65]). | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,6 +5,11 @@ | |||||||
|  |  | ||||||
| from mercurial import hg, ui, commands, util | from mercurial import hg, ui, commands, util | ||||||
| from mercurial import context, subrepo | from mercurial import context, subrepo | ||||||
|  | try: | ||||||
|  |     # hg >= 5.8 | ||||||
|  |     from mercurial.utils import urlutil | ||||||
|  | except ImportError: | ||||||
|  |     from mercurial import util as urlutil | ||||||
|  |  | ||||||
| import re | import re | ||||||
| import sys | import sys | ||||||
| @@ -51,7 +56,13 @@ if sys.version_info[0] == 3: | |||||||
|         stdout = sys.stdout.buffer |         stdout = sys.stdout.buffer | ||||||
|         stderr = sys.stderr.buffer |         stderr = sys.stderr.buffer | ||||||
|         getcwd = os.getcwdb |         getcwd = os.getcwdb | ||||||
|         getenv = os.getenvb if os.supports_bytes_environ else os.getenv |         @staticmethod | ||||||
|  |         def getenvb(val, default): | ||||||
|  |             result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default) | ||||||
|  |              # if result is a string, get bytes instead | ||||||
|  |             result = result.encode() if hasattr(result, 'encode') else result | ||||||
|  |             return result | ||||||
|  |         getenv = os.getenvb if os.supports_bytes_environ else getenvb | ||||||
| else: | else: | ||||||
|     class compat(basecompat): |     class compat(basecompat): | ||||||
|         # life was simple in those days ... |         # life was simple in those days ... | ||||||
| @@ -86,11 +97,27 @@ def debug(msg, *args): | |||||||
| def log(msg, *args): | def log(msg, *args): | ||||||
|     logger.log(logging.LOG, msg, *args) |     logger.log(logging.LOG, msg, *args) | ||||||
|  |  | ||||||
|  | # new style way to import a source file | ||||||
|  | def _imp_load_source(module_name, file_path): | ||||||
|  |     import importlib.util | ||||||
|  |     loader = importlib.machinery.SourceFileLoader(module_name, file_path) | ||||||
|  |     spec = importlib.util.spec_from_loader(module_name, loader) | ||||||
|  |     module = importlib.util.module_from_spec(spec) | ||||||
|  |     sys.modules[module_name] = module | ||||||
|  |     spec.loader.exec_module(module) | ||||||
|  |     return module | ||||||
|  |  | ||||||
| def import_sibling(mod, filename): | def import_sibling(mod, filename): | ||||||
|     import imp |  | ||||||
|     mydir = os.path.dirname(__file__) |     mydir = os.path.dirname(__file__) | ||||||
|     sys.dont_write_bytecode = True |     sys.dont_write_bytecode = True | ||||||
|     return imp.load_source(mod, os.path.join(mydir, filename)) |     vi = sys.version_info | ||||||
|  |     ff = os.path.join(mydir, filename) | ||||||
|  |     if vi.major >= 3 and vi.minor >= 5: | ||||||
|  |         return _imp_load_source(mod, ff) | ||||||
|  |     else: | ||||||
|  |         import imp | ||||||
|  |         return imp.load_source(mod, ff) | ||||||
|  |  | ||||||
|  |  | ||||||
| class GitHgRepo: | class GitHgRepo: | ||||||
|  |  | ||||||
| @@ -135,7 +162,7 @@ class GitHgRepo: | |||||||
|         process = self.start_cmd(args, **kwargs) |         process = self.start_cmd(args, **kwargs) | ||||||
|         output = process.communicate()[0] |         output = process.communicate()[0] | ||||||
|         if check and process.returncode != 0: |         if check and process.returncode != 0: | ||||||
|             die(b'command failed: %s' % b' '.join([compat.to_b(a) for a in cmd])) |             die(b'git command failed: %s' % b' '.join([compat.to_b(a) for a in args])) | ||||||
|         return output |         return output | ||||||
|  |  | ||||||
|     def get_config(self, config, getall=False): |     def get_config(self, config, getall=False): | ||||||
| @@ -216,9 +243,12 @@ class GitHgRepo: | |||||||
|                         warn(b'failed to find local hg for remote %s' % (r)) |                         warn(b'failed to find local hg for remote %s' % (r)) | ||||||
|                         continue |                         continue | ||||||
|                 else: |                 else: | ||||||
|  |                     npath = os.path.abspath(hg_path) | ||||||
|  |                     # use relative path if possible | ||||||
|  |                     if check_version(4, 2): | ||||||
|  |                         npath = os.path.join(b'..', b'..', b'..', b'.hg') | ||||||
|                     # make sure the shared path is always up-to-date |                     # make sure the shared path is always up-to-date | ||||||
|                     util.writefile(os.path.join(local_hg, b'sharedpath'), |                     util.writefile(os.path.join(local_hg, b'sharedpath'), npath) | ||||||
|                         os.path.abspath(hg_path)) |  | ||||||
|                 self.hg_repos[r] = os.path.join(local_path) |                 self.hg_repos[r] = os.path.join(local_path) | ||||||
|  |  | ||||||
|         log('%s determined hg_repos %s', self.identity(), self.hg_repos) |         log('%s determined hg_repos %s', self.identity(), self.hg_repos) | ||||||
| @@ -308,11 +338,11 @@ class GitHgRepo: | |||||||
|             if not kind in (b'hg', b'git'): |             if not kind in (b'hg', b'git'): | ||||||
|                 warn('skipping unsupported subrepo type %s' % kind) |                 warn('skipping unsupported subrepo type %s' % kind) | ||||||
|                 continue |                 continue | ||||||
|             if not util.url(src).isabs(): |             if not urlutil.url(src).isabs(): | ||||||
|                 parent = self.get_hg_repo_url(remote) |                 parent = self.get_hg_repo_url(remote) | ||||||
|                 if not parent: |                 if not parent: | ||||||
|                     die(b'could not determine repo url of %s' % remote) |                     die(b'could not determine repo url of %s' % remote) | ||||||
|                 parent = util.url(parent) |                 parent = urlutil.url(parent) | ||||||
|                 parent.path = posixpath.join(parent.path or b'', src) |                 parent.path = posixpath.join(parent.path or b'', src) | ||||||
|                 parent.path = posixpath.normpath(parent.path) |                 parent.path = posixpath.normpath(parent.path) | ||||||
|                 src = bytes(parent) |                 src = bytes(parent) | ||||||
| @@ -544,6 +574,43 @@ class GcCommand(SubCommand): | |||||||
|                 gm.store() |                 gm.store() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class MapFileCommand(SubCommand): | ||||||
|  |  | ||||||
|  |     def argumentparser(self): | ||||||
|  |         usage = '%%(prog)s %s [options] <remote>' % (self.subcommand) | ||||||
|  |         p = argparse.ArgumentParser(usage=usage) | ||||||
|  |         p.add_argument('--output', required=True, | ||||||
|  |             help='mapfile to write') | ||||||
|  |         p.epilog = textwrap.dedent("""\ | ||||||
|  |         Writes a so-called git-mapfile, as used internally by hg-git. | ||||||
|  |         This files consists of lines of format `<githexsha> <hghexsha>`. | ||||||
|  |  | ||||||
|  |         As such, the result could be used to coax hg-git in some manner. | ||||||
|  |         However, as git-remote-hg and hg-git may (likely) produce different | ||||||
|  |         commits (either git or hg), mixed use of both tools is not recommended. | ||||||
|  |         """) | ||||||
|  |         return p | ||||||
|  |  | ||||||
|  |     def do(self, options, args): | ||||||
|  |         remotehg = import_sibling('remotehg', 'git-remote-hg') | ||||||
|  |  | ||||||
|  |         if not args or len(args) != 1: | ||||||
|  |             self.usage('expect 1 remote') | ||||||
|  |  | ||||||
|  |         remote = args[0] | ||||||
|  |         hgpath = remotehg.select_marks_dir(remote, self.githgrepo.gitdir, False) | ||||||
|  |         puts(b"Loading hg marks ...") | ||||||
|  |         hgm = remotehg.Marks(os.path.join(hgpath, b'marks-hg'), None) | ||||||
|  |         puts(b"Loading git marks ...") | ||||||
|  |         gm = GitMarks(os.path.join(hgpath, b'marks-git')) | ||||||
|  |         puts(b"Writing mapfile ...") | ||||||
|  |         with open(options.output, 'wb') as f: | ||||||
|  |             for c, m in gm.marks.items(): | ||||||
|  |                 hgc = hgm.rev_marks.get(m, None) | ||||||
|  |                 if hgc: | ||||||
|  |                     f.write(b'%s %s\n' % (c, hgc)) | ||||||
|  |  | ||||||
|  |  | ||||||
| class SubRepoCommand(SubCommand): | class SubRepoCommand(SubCommand): | ||||||
|  |  | ||||||
|     def writestate(repo, state): |     def writestate(repo, state): | ||||||
| @@ -910,6 +977,7 @@ def get_subcommands(): | |||||||
|         b'repo': RepoCommand, |         b'repo': RepoCommand, | ||||||
|         b'gc':  GcCommand, |         b'gc':  GcCommand, | ||||||
|         b'sub': SubRepoCommand, |         b'sub': SubRepoCommand, | ||||||
|  |         b'mapfile': MapFileCommand, | ||||||
|         b'help' : HelpCommand |         b'help' : HelpCommand | ||||||
|     } |     } | ||||||
|     # add remote named subcommands |     # add remote named subcommands | ||||||
| @@ -932,6 +1000,7 @@ def do_usage(): | |||||||
|     gc      \t perform maintenance and consistency cleanup on repo tracking marks |     gc      \t perform maintenance and consistency cleanup on repo tracking marks | ||||||
|     sub     \t manage subrepos |     sub     \t manage subrepos | ||||||
|     repo    \t show local hg repo backing a remote |     repo    \t show local hg repo backing a remote | ||||||
|  |     mapfile \t dump a hg-git git-mapfile | ||||||
|  |  | ||||||
|     If the subcommand is the name of a remote hg repo, then any remaining arguments |     If the subcommand is the name of a remote hg repo, then any remaining arguments | ||||||
|     are considered a "hg command", e.g. hg heads, or thg, and it is then executed |     are considered a "hg command", e.g. hg heads, or thg, and it is then executed | ||||||
|   | |||||||
							
								
								
									
										224
									
								
								git-remote-hg
									
									
									
									
									
								
							
							
						
						
									
										224
									
								
								git-remote-hg
									
									
									
									
									
								
							| @@ -86,7 +86,13 @@ if sys.version_info[0] == 3: | |||||||
|         stdout = sys.stdout.buffer |         stdout = sys.stdout.buffer | ||||||
|         stderr = sys.stderr.buffer |         stderr = sys.stderr.buffer | ||||||
|         getcwd = os.getcwdb |         getcwd = os.getcwdb | ||||||
|         getenv = os.getenvb if os.supports_bytes_environ else os.getenv |         @staticmethod | ||||||
|  |         def getenvb(val, default): | ||||||
|  |             result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default) | ||||||
|  |              # if result is a string, get bytes instead | ||||||
|  |             result = result.encode() if hasattr(result, 'encode') else result | ||||||
|  |             return result | ||||||
|  |         getenv = os.getenvb if os.supports_bytes_environ else getenvb | ||||||
|         urlparse = urllib.parse.urlparse |         urlparse = urllib.parse.urlparse | ||||||
|         urljoin = urllib.parse.urljoin |         urljoin = urllib.parse.urljoin | ||||||
| else: | else: | ||||||
| @@ -116,6 +122,27 @@ else: | |||||||
|         urlparse = staticmethod(_urlparse) |         urlparse = staticmethod(_urlparse) | ||||||
|         urljoin = staticmethod(_urljoin) |         urljoin = staticmethod(_urljoin) | ||||||
|  |  | ||||||
|  | # new style way to import a source file | ||||||
|  | def _imp_load_source(module_name, file_path): | ||||||
|  |     import importlib.util | ||||||
|  |     loader = importlib.machinery.SourceFileLoader(module_name, file_path) | ||||||
|  |     spec = importlib.util.spec_from_loader(module_name, loader) | ||||||
|  |     module = importlib.util.module_from_spec(spec) | ||||||
|  |     sys.modules[module_name] = module | ||||||
|  |     spec.loader.exec_module(module) | ||||||
|  |     return module | ||||||
|  |  | ||||||
|  | def import_sibling(mod, filename): | ||||||
|  |     mydir = os.path.dirname(__file__) | ||||||
|  |     sys.dont_write_bytecode = True | ||||||
|  |     vi = sys.version_info | ||||||
|  |     ff = os.path.join(mydir, filename) | ||||||
|  |     if vi.major >= 3 and vi.minor >= 5: | ||||||
|  |         return _imp_load_source(mod, ff) | ||||||
|  |     else: | ||||||
|  |         import imp | ||||||
|  |         return imp.load_source(mod, ff) | ||||||
|  |  | ||||||
| # | # | ||||||
| # If you want to see Mercurial revisions as Git commit notes: | # If you want to see Mercurial revisions as Git commit notes: | ||||||
| # git config core.notesRef refs/notes/hg | # git config core.notesRef refs/notes/hg | ||||||
| @@ -141,11 +168,11 @@ else: | |||||||
| # Commits are modified to preserve hg information and allow bidirectionality. | # Commits are modified to preserve hg information and allow bidirectionality. | ||||||
| # | # | ||||||
|  |  | ||||||
| NAME_RE = re.compile(b'^([^<>]+)') | NAME_RE = re.compile(br'^([^<>]+)') | ||||||
| AUTHOR_RE = re.compile(b'^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)') | AUTHOR_RE = re.compile(br'^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)') | ||||||
| EMAIL_RE = re.compile(br'([^ \t<>]+@[^ \t<>]+)') | EMAIL_RE = re.compile(br'([^ \t<>]+@[^ \t<>]+)') | ||||||
| AUTHOR_HG_RE = re.compile(b'^(.*?) ?<(.*?)(?:>(.*))?$') | AUTHOR_HG_RE = re.compile(br'^(.*?) ?<(.*?)(?:>(.*))?$') | ||||||
| RAW_AUTHOR_RE = re.compile(b'^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)') | RAW_AUTHOR_RE = re.compile(br'^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)') | ||||||
|  |  | ||||||
| VERSION = 2 | VERSION = 2 | ||||||
|  |  | ||||||
| @@ -153,6 +180,9 @@ def die(msg): | |||||||
|     compat.stderr.write(b'ERROR: %s\n' % compat.to_b(msg, 'utf-8')) |     compat.stderr.write(b'ERROR: %s\n' % compat.to_b(msg, 'utf-8')) | ||||||
|     sys.exit(1) |     sys.exit(1) | ||||||
|  |  | ||||||
|  | def debug(*args): | ||||||
|  |     compat.stderr.write(b'DEBUG: %s\n' % compat.to_b(repr(args))) | ||||||
|  |  | ||||||
| def warn(msg): | def warn(msg): | ||||||
|     compat.stderr.write(b'WARNING: %s\n' % compat.to_b(msg, 'utf-8')) |     compat.stderr.write(b'WARNING: %s\n' % compat.to_b(msg, 'utf-8')) | ||||||
|     compat.stderr.flush() |     compat.stderr.flush() | ||||||
| @@ -231,27 +261,17 @@ def get_rev_hg(commit): | |||||||
|  |  | ||||||
| class Marks: | class Marks: | ||||||
|  |  | ||||||
|     def __init__(self, path, repo): |     def __init__(self, path, _repo=None): | ||||||
|         self.path = path |         self.path = path | ||||||
|         self.repo = repo |  | ||||||
|         self.clear() |         self.clear() | ||||||
|         self.load() |         self.load() | ||||||
|  |  | ||||||
|         if self.version < VERSION: |  | ||||||
|             if self.version == 1: |  | ||||||
|                 self.upgrade_one() |  | ||||||
|  |  | ||||||
|             # upgraded? |  | ||||||
|             if self.version < VERSION: |  | ||||||
|                 self.clear() |  | ||||||
|                 self.version = VERSION |  | ||||||
|  |  | ||||||
|     def clear(self): |     def clear(self): | ||||||
|         self.tips = {} |         self.tips = {} | ||||||
|         self.marks = {} |         self.marks = {} | ||||||
|         self.rev_marks = {} |         self.rev_marks = {} | ||||||
|         self.last_mark = 0 |         self.last_mark = 0 | ||||||
|         self.version = 0 |         self.version = VERSION | ||||||
|         self.last_note = 0 |         self.last_note = 0 | ||||||
|  |  | ||||||
|     def load(self): |     def load(self): | ||||||
| @@ -267,20 +287,12 @@ class Marks: | |||||||
|         self.tips = [] |         self.tips = [] | ||||||
|         self.marks = marks |         self.marks = marks | ||||||
|         self.last_mark = tmp['last-mark'] |         self.last_mark = tmp['last-mark'] | ||||||
|         self.version = tmp.get('version', 1) |         self.version = tmp['version'] | ||||||
|         self.last_note = 0 |         self.last_note = 0 | ||||||
|  |  | ||||||
|         for rev, mark in compat.iteritems(self.marks): |         for rev, mark in compat.iteritems(self.marks): | ||||||
|             self.rev_marks[mark] = rev |             self.rev_marks[mark] = rev | ||||||
|  |  | ||||||
|     def upgrade_one(self): |  | ||||||
|         def get_id(rev): |  | ||||||
|             return hghex(self.repo.changelog.node(int(rev))) |  | ||||||
|         self.tips = dict((name, get_id(rev)) for name, rev in compat.iteritems(self.tips)) |  | ||||||
|         self.marks = dict((get_id(rev), mark) for rev, mark in compat.iteritems(self.marks)) |  | ||||||
|         self.rev_marks = dict((mark, get_id(rev)) for mark, rev in compat.iteritems(self.rev_marks)) |  | ||||||
|         self.version = 2 |  | ||||||
|  |  | ||||||
|     def dict(self): |     def dict(self): | ||||||
|         return { 'tips': self.tips, 'marks': self.marks, |         return { 'tips': self.tips, 'marks': self.marks, | ||||||
|                 'last-mark': self.last_mark, 'version': self.version, |                 'last-mark': self.last_mark, 'version': self.version, | ||||||
| @@ -383,7 +395,7 @@ class Parser: | |||||||
|             return None |             return None | ||||||
|         _, name, email, date, tz = m.groups() |         _, name, email, date, tz = m.groups() | ||||||
|         if name and b'ext:' in name: |         if name and b'ext:' in name: | ||||||
|             m = re.match(b'^(.+?) ext:\((.+)\)$', name) |             m = re.match(br'^(.+?) ext:\((.+)\)$', name) | ||||||
|             if m: |             if m: | ||||||
|                 name = m.group(1) |                 name = m.group(1) | ||||||
|                 ex = compat.urlunquote(m.group(2)) |                 ex = compat.urlunquote(m.group(2)) | ||||||
| @@ -402,20 +414,16 @@ class Parser: | |||||||
|         return (user, int(date), hgtz(tz)) |         return (user, int(date), hgtz(tz)) | ||||||
|  |  | ||||||
| def fix_file_path(path): | def fix_file_path(path): | ||||||
|     def posix_path(path): |     path = os.path.normpath(path) | ||||||
|  |     if os.path.isabs(path): | ||||||
|  |         path = os.path.relpath(path, b'/') | ||||||
|     if os.sep == '/': |     if os.sep == '/': | ||||||
|         return path |         return path | ||||||
|     # even Git for Windows expects forward |     # even Git for Windows expects forward | ||||||
|     return path.replace(compat.to_b(os.sep), b'/') |     return path.replace(compat.to_b(os.sep), b'/') | ||||||
|     # also converts forward slash to backwards slash on Win |  | ||||||
|     path = os.path.normpath(path) |  | ||||||
|     if not os.path.isabs(path): |  | ||||||
|         return posix_path(path) |  | ||||||
|     return posix_path(os.path.relpath(path, b'/')) |  | ||||||
|  |  | ||||||
| def export_files(files): | def export_file(ctx, fname): | ||||||
|     final = [] |     f = ctx.filectx(fname) | ||||||
|     for f in files: |  | ||||||
|     fid = node.hex(f.filenode()) |     fid = node.hex(f.filenode()) | ||||||
|  |  | ||||||
|     if fid in filenodes: |     if fid in filenodes: | ||||||
| @@ -428,14 +436,16 @@ def export_files(files): | |||||||
|         puts(b"blob") |         puts(b"blob") | ||||||
|         puts(b"mark :%u" % mark) |         puts(b"mark :%u" % mark) | ||||||
|         puts(b"data %d" % len(d)) |         puts(b"data %d" % len(d)) | ||||||
|             puts(d) |         puts(f.data()) | ||||||
|  |  | ||||||
|         path = fix_file_path(f.path()) |     path = fixup_path_to_git(fix_file_path(f.path())) | ||||||
|         final.append((gitmode(f.flags()), mark, path)) |     return (gitmode(f.flags()), mark, path) | ||||||
|  |  | ||||||
|     return final |  | ||||||
|  |  | ||||||
| def get_filechanges(repo, ctx, parent): | def get_filechanges(repo, ctx, parent): | ||||||
|  |     if hasattr(parent, 'status'): | ||||||
|  |         stat = parent.status(ctx) | ||||||
|  |         return stat.modified + stat.added, stat.removed | ||||||
|  |  | ||||||
|     modified = set() |     modified = set() | ||||||
|     added = set() |     added = set() | ||||||
|     removed = set() |     removed = set() | ||||||
| @@ -477,7 +487,7 @@ def fixup_user_git(user): | |||||||
| def fixup_user_hg(user): | def fixup_user_hg(user): | ||||||
|     def sanitize(name): |     def sanitize(name): | ||||||
|         # stole this from hg-git |         # stole this from hg-git | ||||||
|         return re.sub(b'[<>\n]', b'?', name.lstrip(b'< ').rstrip(b'> ')) |         return re.sub(br'[<>\n]', b'?', name.lstrip(b'< ').rstrip(b'> ')) | ||||||
|  |  | ||||||
|     m = AUTHOR_HG_RE.match(user) |     m = AUTHOR_HG_RE.match(user) | ||||||
|     if m: |     if m: | ||||||
| @@ -508,6 +518,51 @@ def fixup_user(user): | |||||||
|  |  | ||||||
|     return b'%s <%s>' % (name, mail) |     return b'%s <%s>' % (name, mail) | ||||||
|  |  | ||||||
|  | # (recent) git fast-import does not accept .git or .gitmodule component names | ||||||
|  | # (anywhere, case-insensitive) | ||||||
|  | # in any case, surprising things may happen, so add some front-end replacement magic; | ||||||
|  | # transform of (hg) .git(0 or more suffix) to (git) .git(1 or more suffix) | ||||||
|  | # (likewise so for any invalid git keyword) | ||||||
|  | def fixup_dotfile_path(path, suffix, add): | ||||||
|  |     def subst(part): | ||||||
|  |         if (not part) or part[0] != ord(b'.'): | ||||||
|  |             return part | ||||||
|  |         for prefix in (b'.git', b'.gitmodules'): | ||||||
|  |             pl = len(prefix) | ||||||
|  |             tail = len(part) - pl | ||||||
|  |             if tail < 0: | ||||||
|  |                 continue | ||||||
|  |             if part[0:pl].lower() == prefix and part[pl:] == suffix * tail: | ||||||
|  |                 if add: | ||||||
|  |                     return part + suffix | ||||||
|  |                 elif tail == 0: | ||||||
|  |                     # .git should not occur in git space | ||||||
|  |                     # so complain | ||||||
|  |                     if pl == 3: | ||||||
|  |                         die('invalid path component %s' % part) | ||||||
|  |                     else: | ||||||
|  |                         # but .gitmodules might | ||||||
|  |                         # leave as-is, it is handled/ignored elsewhere | ||||||
|  |                         return part | ||||||
|  |                 else: | ||||||
|  |                     return part[0:-1] | ||||||
|  |         return part | ||||||
|  |     # quick optimization check; | ||||||
|  |     if (not path) or (path[0] != ord(b'.') and path.find(b'/.') < 0): | ||||||
|  |         return path | ||||||
|  |     sep = b'/' | ||||||
|  |     return sep.join((subst(part) for part in path.split(sep))) | ||||||
|  |  | ||||||
|  | def fixup_path_to_git(path): | ||||||
|  |     if not dotfile_suffix: | ||||||
|  |         return path | ||||||
|  |     return fixup_dotfile_path(path, dotfile_suffix, True) | ||||||
|  |  | ||||||
|  | def fixup_path_from_git(path): | ||||||
|  |     if not dotfile_suffix: | ||||||
|  |         return path | ||||||
|  |     return fixup_dotfile_path(path, dotfile_suffix, False) | ||||||
|  |  | ||||||
| def updatebookmarks(repo, peer): | def updatebookmarks(repo, peer): | ||||||
|     remotemarks = peer.listkeys(b'bookmarks') |     remotemarks = peer.listkeys(b'bookmarks') | ||||||
|  |  | ||||||
| @@ -579,18 +634,6 @@ def get_repo(url, alias): | |||||||
|     else: |     else: | ||||||
|         shared_path = os.path.join(gitdir, b'hg') |         shared_path = os.path.join(gitdir, b'hg') | ||||||
|  |  | ||||||
|         # check and upgrade old organization |  | ||||||
|         hg_path = os.path.join(shared_path, b'.hg') |  | ||||||
|         if os.path.exists(shared_path) and not os.path.exists(hg_path): |  | ||||||
|             repos = os.listdir(shared_path) |  | ||||||
|             for x in repos: |  | ||||||
|                 local_hg = os.path.join(shared_path, x, b'clone', b'.hg') |  | ||||||
|                 if not os.path.exists(local_hg): |  | ||||||
|                     continue |  | ||||||
|                 if not os.path.exists(hg_path): |  | ||||||
|                     shutil.move(local_hg, hg_path) |  | ||||||
|                 shutil.rmtree(os.path.join(shared_path, x, b'clone')) |  | ||||||
|  |  | ||||||
|         # setup shared repo (if not there) |         # setup shared repo (if not there) | ||||||
|         try: |         try: | ||||||
|             hg.peer(myui, {}, shared_path, create=True) |             hg.peer(myui, {}, shared_path, create=True) | ||||||
| @@ -601,8 +644,13 @@ def get_repo(url, alias): | |||||||
|             os.makedirs(dirname) |             os.makedirs(dirname) | ||||||
|  |  | ||||||
|         local_path = os.path.join(dirname, b'clone') |         local_path = os.path.join(dirname, b'clone') | ||||||
|  |         kwargs = {} | ||||||
|  |         hg_path = os.path.join(shared_path, b'.hg') | ||||||
|  |         if check_version(4, 2): | ||||||
|  |             kwargs = {'relative': True} | ||||||
|  |             hg_path = os.path.join(b'..', b'..', b'..', b'.hg') | ||||||
|         if not os.path.exists(local_path): |         if not os.path.exists(local_path): | ||||||
|             hg.share(myui, shared_path, local_path, update=False) |             hg.share(myui, shared_path, local_path, update=False, **kwargs) | ||||||
|         else: |         else: | ||||||
|             # make sure the shared path is always up-to-date |             # make sure the shared path is always up-to-date | ||||||
|             util.writefile(os.path.join(local_path, b'.hg', b'sharedpath'), hg_path) |             util.writefile(os.path.join(local_path, b'.hg', b'sharedpath'), hg_path) | ||||||
| @@ -711,11 +759,16 @@ def export_ref(repo, name, kind, head): | |||||||
|                 if rename: |                 if rename: | ||||||
|                     renames.append((rename[0], f)) |                     renames.append((rename[0], f)) | ||||||
|  |  | ||||||
|  |             # NOTE no longer used in hg-git, a HG:rename extra header is used | ||||||
|             for e in renames: |             for e in renames: | ||||||
|                 extra_msg += b"rename : %s => %s\n" % e |                 extra_msg += b"rename : %s => %s\n" % e | ||||||
|  |  | ||||||
|             for key, value in compat.iteritems(extra): |             for key, value in compat.iteritems(extra): | ||||||
|                 if key in (b'author', b'committer', b'encoding', b'message', b'branch', b'hg-git'): |                 if key in (b'author', b'committer', b'encoding', b'message', b'branch', b'hg-git', b'transplant_source'): | ||||||
|  |                     continue | ||||||
|  |                 elif key == b'hg-git-rename-source' and value == b'git': | ||||||
|  |                     # extra data that hg-git might put there unconditionally | ||||||
|  |                     # or that we put in there to be compatible | ||||||
|                     continue |                     continue | ||||||
|                 else: |                 else: | ||||||
|                     extra_msg += b"extra : %s : %s\n" % (key, compat.urlquote(value)) |                     extra_msg += b"extra : %s : %s\n" % (key, compat.urlquote(value)) | ||||||
| @@ -726,7 +779,7 @@ def export_ref(repo, name, kind, head): | |||||||
|         if len(parents) == 0: |         if len(parents) == 0: | ||||||
|             puts(b'reset %s/%s' % (prefix, ename)) |             puts(b'reset %s/%s' % (prefix, ename)) | ||||||
|  |  | ||||||
|         modified_final = export_files(c.filectx(f) for f in modified) |         modified_final = [export_file(c, fname) for fname in modified] | ||||||
|  |  | ||||||
|         puts(b"commit %s/%s" % (prefix, ename)) |         puts(b"commit %s/%s" % (prefix, ename)) | ||||||
|         puts(b"mark :%d" % (marks.get_mark(c.hex()))) |         puts(b"mark :%d" % (marks.get_mark(c.hex()))) | ||||||
| @@ -741,7 +794,7 @@ def export_ref(repo, name, kind, head): | |||||||
|                 puts(b"merge :%u" % (rev_to_mark(parents[1]))) |                 puts(b"merge :%u" % (rev_to_mark(parents[1]))) | ||||||
|  |  | ||||||
|         for f in removed: |         for f in removed: | ||||||
|             puts(b"D %s" % (fix_file_path(f))) |             puts(b"D %s" % fixup_path_to_git(fix_file_path(f))) | ||||||
|         for f in modified_final: |         for f in modified_final: | ||||||
|             puts(b"M %s :%u %s" % f) |             puts(b"M %s :%u %s" % f) | ||||||
|         puts() |         puts() | ||||||
| @@ -839,9 +892,12 @@ def do_list(parser, branchmap): | |||||||
|  |  | ||||||
|     for branch, heads in compat.iteritems(branchmap): |     for branch, heads in compat.iteritems(branchmap): | ||||||
|         # only open heads |         # only open heads | ||||||
|  |         try: | ||||||
|             heads = [h for h in heads if b'close' not in repo.changelog.read(h)[5]] |             heads = [h for h in heads if b'close' not in repo.changelog.read(h)[5]] | ||||||
|             if heads: |             if heads: | ||||||
|                 branches[branch] = heads |                 branches[branch] = heads | ||||||
|  |         except error.LookupError: | ||||||
|  |             branches[branch] = heads | ||||||
|  |  | ||||||
|     list_head(repo, cur) |     list_head(repo, cur) | ||||||
|  |  | ||||||
| @@ -1031,6 +1087,7 @@ def parse_commit(parser): | |||||||
|         else: |         else: | ||||||
|             die(b'Unknown file command: %s' % line) |             die(b'Unknown file command: %s' % line) | ||||||
|         path = c_style_unescape(path) |         path = c_style_unescape(path) | ||||||
|  |         path = fixup_path_from_git(path) | ||||||
|         files[path] = files.get(path, {}) |         files[path] = files.get(path, {}) | ||||||
|         files[path].update(f) |         files[path].update(f) | ||||||
|  |  | ||||||
| @@ -1135,10 +1192,20 @@ def parse_commit(parser): | |||||||
|         extra[b'branch'] = hgref(branch) |         extra[b'branch'] = hgref(branch) | ||||||
|  |  | ||||||
|     if mode == 'hg': |     if mode == 'hg': | ||||||
|  |         # add some extra that hg-git adds (almost) unconditionally | ||||||
|  |         # see also https://foss.heptapod.net/mercurial/hg-git/-/merge_requests/211 | ||||||
|  |         # NOTE it could be changed to another value below | ||||||
|  |         # actually, it is *almost* unconditionally, and only done if the commit | ||||||
|  |         # is deduced to originate in git.  However, the latter is based on | ||||||
|  |         # presence/absence of HG markers in commit "extra headers". | ||||||
|  |         # The latter can not be handled here, and so this can not be correctly | ||||||
|  |         # reproduced. | ||||||
|  |         # extra[b'hg-git-rename-source'] = b'git' | ||||||
|         i = data.find(b'\n--HG--\n') |         i = data.find(b'\n--HG--\n') | ||||||
|         if i >= 0: |         if i >= 0: | ||||||
|             tmp = data[i + len(b'\n--HG--\n'):].strip() |             tmp = data[i + len(b'\n--HG--\n'):].strip() | ||||||
|             for k, v in [e.split(b' : ', 1) for e in tmp.split(b'\n')]: |             for k, v in [e.split(b' : ', 1) for e in tmp.split(b'\n')]: | ||||||
|  |                 # NOTE no longer used in hg-git, a HG:rename extra header is used | ||||||
|                 if k == b'rename': |                 if k == b'rename': | ||||||
|                     old, new = v.split(b' => ', 1) |                     old, new = v.split(b' => ', 1) | ||||||
|                     files[new]['rename'] = old |                     files[new]['rename'] = old | ||||||
| @@ -1326,6 +1393,9 @@ def checkheads(repo, remote, p_revs, force): | |||||||
| def push_unsafe(repo, remote, p_revs, force): | def push_unsafe(repo, remote, p_revs, force): | ||||||
|  |  | ||||||
|     fci = discovery.findcommonincoming |     fci = discovery.findcommonincoming | ||||||
|  |     if check_version(4, 5): | ||||||
|  |         commoninc = fci(repo, remote, force=force, ancestorsof=list(p_revs)) | ||||||
|  |     else: | ||||||
|         commoninc = fci(repo, remote, force=force) |         commoninc = fci(repo, remote, force=force) | ||||||
|     common, _, remoteheads = commoninc |     common, _, remoteheads = commoninc | ||||||
|     fco = discovery.findcommonoutgoing |     fco = discovery.findcommonoutgoing | ||||||
| @@ -1357,12 +1427,6 @@ def push_unsafe(repo, remote, p_revs, force): | |||||||
|     else: |     else: | ||||||
|         ret = remote.addchangegroup(cg, b'push', repo.url()) |         ret = remote.addchangegroup(cg, b'push', repo.url()) | ||||||
|  |  | ||||||
|     phases = remote.listkeys(b'phases') |  | ||||||
|     if phases: |  | ||||||
|         for head in p_revs: |  | ||||||
|             # update to public |  | ||||||
|             remote.pushkey(b'phases', hghex(head), b'1', b'0') |  | ||||||
|  |  | ||||||
|     return ret |     return ret | ||||||
|  |  | ||||||
| def push(repo, remote, p_revs, force): | def push(repo, remote, p_revs, force): | ||||||
| @@ -1397,6 +1461,7 @@ def do_push_hg(parser): | |||||||
|     global parsed_refs, parsed_tags |     global parsed_refs, parsed_tags | ||||||
|     p_bmarks = [] |     p_bmarks = [] | ||||||
|     p_revs = {} |     p_revs = {} | ||||||
|  |     ok_refs = [] | ||||||
|  |  | ||||||
|     parsed_refs = {} |     parsed_refs = {} | ||||||
|     parsed_tags = {} |     parsed_tags = {} | ||||||
| @@ -1443,7 +1508,7 @@ def do_push_hg(parser): | |||||||
|                 continue |                 continue | ||||||
|  |  | ||||||
|             p_revs[bnode] = ref |             p_revs[bnode] = ref | ||||||
|             puts(b"ok %s" % ref) |             ok_refs.append(ref) | ||||||
|         elif ref.startswith(b'refs/heads/'): |         elif ref.startswith(b'refs/heads/'): | ||||||
|             bmark = ref[len(b'refs/heads/'):] |             bmark = ref[len(b'refs/heads/'):] | ||||||
|             new = node |             new = node | ||||||
| @@ -1453,14 +1518,14 @@ def do_push_hg(parser): | |||||||
|                 puts(b"ok %s up to date" % ref) |                 puts(b"ok %s up to date" % ref) | ||||||
|                 continue |                 continue | ||||||
|  |  | ||||||
|             puts(b"ok %s" % ref) |             ok_refs.append(ref) | ||||||
|             if not bookmark_is_fake(bmark, parser.repo._bookmarks): |             if not bookmark_is_fake(bmark, parser.repo._bookmarks): | ||||||
|                 p_bmarks.append((ref, bmark, old, new)) |                 p_bmarks.append((ref, bmark, old, new)) | ||||||
|  |  | ||||||
|             p_revs[bnode] = ref |             p_revs[bnode] = ref | ||||||
|         elif ref.startswith(b'refs/tags/'): |         elif ref.startswith(b'refs/tags/'): | ||||||
|             if dry_run: |             if dry_run: | ||||||
|                 puts(b"ok %s" % ref) |                 ok_refs.append(ref) | ||||||
|                 continue |                 continue | ||||||
|             tag = ref[len(b'refs/tags/'):] |             tag = ref[len(b'refs/tags/'):] | ||||||
|             tag = hgref(tag) |             tag = hgref(tag) | ||||||
| @@ -1487,14 +1552,15 @@ def do_push_hg(parser): | |||||||
|                 fp.write(b'%s %s\n' % (node, tag)) |                 fp.write(b'%s %s\n' % (node, tag)) | ||||||
|                 fp.close() |                 fp.close() | ||||||
|             p_revs[bnode] = ref |             p_revs[bnode] = ref | ||||||
|             puts(b"ok %s" % ref) |             ok_refs.append(ref) | ||||||
|         else: |         else: | ||||||
|             # transport-helper/fast-export bugs |             # transport-helper/fast-export bugs | ||||||
|             continue |             continue | ||||||
|  |  | ||||||
|     if dry_run: |     if dry_run: | ||||||
|         if peer: |         if not peer or checkheads(parser.repo, peer, p_revs, force_push): | ||||||
|             checkheads(parser.repo, peer, p_revs, force_push) |             for ref in ok_refs: | ||||||
|  |                 puts(b"ok %s" % ref) | ||||||
|         return |         return | ||||||
|  |  | ||||||
|     success = True |     success = True | ||||||
| @@ -1515,12 +1581,18 @@ def do_push_hg(parser): | |||||||
|             if not peer.pushkey(b'bookmarks', bmark, old, new): |             if not peer.pushkey(b'bookmarks', bmark, old, new): | ||||||
|                 success = False |                 success = False | ||||||
|                 puts(b"error %s" % ref) |                 puts(b"error %s" % ref) | ||||||
|  |                 ok_refs.remove(ref) | ||||||
|     else: |     else: | ||||||
|         # update local bookmarks |         # update local bookmarks | ||||||
|         for ref, bmark, old, new in p_bmarks: |         for ref, bmark, old, new in p_bmarks: | ||||||
|             if not bookmarks.pushbookmark(parser.repo, bmark, old, new): |             if not bookmarks.pushbookmark(parser.repo, bmark, old, new): | ||||||
|                 success = False |                 success = False | ||||||
|                 puts(b"error %s" % ref) |                 puts(b"error %s" % ref) | ||||||
|  |                 ok_refs.remove(ref) | ||||||
|  |  | ||||||
|  |     # update rest of the refs | ||||||
|  |     for ref in ok_refs: | ||||||
|  |         puts(b"ok %s" % ref) | ||||||
|  |  | ||||||
|     return success |     return success | ||||||
|  |  | ||||||
| @@ -1604,10 +1676,7 @@ def do_push_refspec(parser, refspec, revs): | |||||||
|             tmpfastexport = open(os.path.join(marksdir, b'git-fast-export-%d' % (os.getpid())), 'w+b') |             tmpfastexport = open(os.path.join(marksdir, b'git-fast-export-%d' % (os.getpid())), 'w+b') | ||||||
|             subprocess.check_call(cmd, stdin=None, stdout=tmpfastexport) |             subprocess.check_call(cmd, stdin=None, stdout=tmpfastexport) | ||||||
|             try: |             try: | ||||||
|                 import imp |                 ctx.hghelper = import_sibling('hghelper', 'git-hg-helper') | ||||||
|                 sys.dont_write_bytecode = True |  | ||||||
|                 ctx.hghelper = imp.load_source('hghelper', \ |  | ||||||
|                     os.path.join(os.path.dirname(__file__), 'git-hg-helper')) |  | ||||||
|                 ctx.hghelper.init_git(gitdir) |                 ctx.hghelper.init_git(gitdir) | ||||||
|                 ctx.gitmarks = ctx.hghelper.GitMarks(tmpmarks) |                 ctx.gitmarks = ctx.hghelper.GitMarks(tmpmarks) | ||||||
|                 # let processing know it should not bother pushing if not requested |                 # let processing know it should not bother pushing if not requested | ||||||
| @@ -1729,8 +1798,7 @@ def fix_path(alias, repo, orig_url): | |||||||
|     url = compat.urlparse(orig_url, b'file') |     url = compat.urlparse(orig_url, b'file') | ||||||
|     if url.scheme != b'file' or os.path.isabs(os.path.expanduser(url.path)): |     if url.scheme != b'file' or os.path.isabs(os.path.expanduser(url.path)): | ||||||
|         return |         return | ||||||
|     abs_url = compat.urljoin(b"%s/" % compat.getcwd(), orig_url) |     cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % os.path.abspath(orig_url)] | ||||||
|     cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % abs_url] |  | ||||||
|     subprocess.call(cmd) |     subprocess.call(cmd) | ||||||
|  |  | ||||||
| def select_private_refs(alias): | def select_private_refs(alias): | ||||||
| @@ -1845,6 +1913,7 @@ def main(args): | |||||||
|     global capability_push |     global capability_push | ||||||
|     global remove_username_quotes |     global remove_username_quotes | ||||||
|     global marksdir |     global marksdir | ||||||
|  |     global dotfile_suffix | ||||||
|  |  | ||||||
|     marks = None |     marks = None | ||||||
|     is_tmp = False |     is_tmp = False | ||||||
| @@ -1864,6 +1933,7 @@ def main(args): | |||||||
|     track_branches = get_config_bool('remote-hg.track-branches', True) |     track_branches = get_config_bool('remote-hg.track-branches', True) | ||||||
|     capability_push = get_config_bool('remote-hg.capability-push', True) |     capability_push = get_config_bool('remote-hg.capability-push', True) | ||||||
|     remove_username_quotes = get_config_bool('remote-hg.remove-username-quotes', True) |     remove_username_quotes = get_config_bool('remote-hg.remove-username-quotes', True) | ||||||
|  |     dotfile_suffix = get_config('remote-hg.dotfile-suffix').strip() or b'_' | ||||||
|     force_push = False |     force_push = False | ||||||
|  |  | ||||||
|     if hg_git_compat: |     if hg_git_compat: | ||||||
| @@ -1908,7 +1978,7 @@ def main(args): | |||||||
|         fix_path(alias, peer or repo, url) |         fix_path(alias, peer or repo, url) | ||||||
|  |  | ||||||
|     marks_path = os.path.join(marksdir, b'marks-hg') |     marks_path = os.path.join(marksdir, b'marks-hg') | ||||||
|     marks = Marks(marks_path, repo) |     marks = Marks(marks_path) | ||||||
|  |  | ||||||
|     if sys.platform == 'win32': |     if sys.platform == 'win32': | ||||||
|         import msvcrt |         import msvcrt | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ | |||||||
| import setuptools | import setuptools | ||||||
|  |  | ||||||
| # strip leading v | # strip leading v | ||||||
| version = 'v1.0.3'[1:] | version = 'v1.0.5'[1:] | ||||||
|  |  | ||||||
| # check for released version | # check for released version | ||||||
| assert (len(version) > 0) | assert (len(version) > 0) | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| RM ?= rm -f | RM ?= rm -f | ||||||
|  |  | ||||||
| T = main.t main-push.t bidi.t helper.t | T = main.t main-push.t bidi.t helper.t | ||||||
| TEST_DIRECTORY := $(CURDIR) | SHARNESS_TEST_DIRECTORY := $(CURDIR) | ||||||
|  |  | ||||||
| export TEST_DIRECTORY | export SHARNESS_TEST_DIRECTORY | ||||||
|  |  | ||||||
| all: test | all: test | ||||||
|  |  | ||||||
| @@ -11,7 +11,7 @@ test: $(T) | |||||||
| 	$(MAKE) clean | 	$(MAKE) clean | ||||||
|  |  | ||||||
| $(T): | $(T): | ||||||
| 	$(SHELL) $@ $(TEST_OPTS) | 	./$@ $(TEST_OPTS) | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	$(RM) -r 'trash directory'.* test-results | 	$(RM) -r 'trash directory'.* test-results | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								test/bidi.t
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								test/bidi.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| #!/bin/sh | #!/bin/bash | ||||||
| # | # | ||||||
| # Copyright (c) 2012 Felipe Contreras | # Copyright (c) 2012 Felipe Contreras | ||||||
| # | # | ||||||
| @@ -8,14 +8,7 @@ | |||||||
|  |  | ||||||
| test_description='Test bidirectionality of remote-hg' | test_description='Test bidirectionality of remote-hg' | ||||||
|  |  | ||||||
| test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/ | . ./test-lib.sh | ||||||
| . "$TEST_DIRECTORY"/test-lib.sh |  | ||||||
|  |  | ||||||
| if ! test_have_prereq PYTHON |  | ||||||
| then |  | ||||||
| 	skip_all='skipping remote-hg tests; python with mercurial not available' |  | ||||||
| 	test_done |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| # clone to a git repo | # clone to a git repo | ||||||
| git_clone () { | git_clone () { | ||||||
|   | |||||||
							
								
								
									
										60
									
								
								test/expected/converged merge/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								test/expected/converged merge/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 2 | ||||||
|  | A | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 7 | ||||||
|  | origin | ||||||
|  | M 100644 :1 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 2 | ||||||
|  | C | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 3 +0000 | ||||||
|  | committer A U Thor <author@example.com> 3 +0000 | ||||||
|  | data 5 | ||||||
|  | A->C | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 2 | ||||||
|  | B | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author A U Thor <author@example.com> 1 +0000 | ||||||
|  | committer A U Thor <author@example.com> 1 +0000 | ||||||
|  | data 5 | ||||||
|  | A->B | ||||||
|  | from :2 | ||||||
|  | M 100644 :5 afile | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :7 | ||||||
|  | author A U Thor <author@example.com> 2 +0000 | ||||||
|  | committer A U Thor <author@example.com> 2 +0000 | ||||||
|  | data 5 | ||||||
|  | B->C | ||||||
|  | from :6 | ||||||
|  | M 100644 :3 afile | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :8 | ||||||
|  | author A U Thor <author@example.com> 4 +0000 | ||||||
|  | committer A U Thor <author@example.com> 4 +0000 | ||||||
|  | data 6 | ||||||
|  | merge | ||||||
|  | from :4 | ||||||
|  | merge :7 | ||||||
|  |  | ||||||
							
								
								
									
										67
									
								
								test/expected/converged merge/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								test/expected/converged merge/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | |||||||
|  | changeset:   9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    331ac2e605f2e6092ccb3802244a65b71f3be726 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | origin | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    894f8ad9a84f743d52747963d0b9f4e9cf37d489 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:01 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->B | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   541c7bc8b2d01c8bf71b2298d17edcda120e49bf | ||||||
|  | phase:       draft | ||||||
|  | parent:      ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    04dae4001cb1fb2384111589720617c4b742044c | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:02 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | B->C | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   5694aadcd7171ecb9768b13e29d027e22a360d44 | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    6efc6bb8e097947aa212887bdb01fb89dfa3de13 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:03 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->C | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   9ee75b4362cc15f9110d6538b2f1c9f0cf14825a | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      5694aadcd7171ecb9768b13e29d027e22a360d44 | ||||||
|  | parent:      541c7bc8b2d01c8bf71b2298d17edcda120e49bf | ||||||
|  | manifest:    eb9f4687448653e876d787cd6f2e59140680ff09 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:04 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | merge | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										56
									
								
								test/expected/encoding/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								test/expected/encoding/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 12 | ||||||
|  | add älphà | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 5 | ||||||
|  | beta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author tést èncödîng <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 9 | ||||||
|  | add beta | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 beta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 6 | ||||||
|  | gamma | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author tést èncödîng <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 12 | ||||||
|  | add gämmâ | ||||||
|  | from :4 | ||||||
|  | M 100644 :5 gamma | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :7 | ||||||
|  | data 6 | ||||||
|  | delta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :8 | ||||||
|  | author tést èncödîng <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 12 | ||||||
|  | add déltà | ||||||
|  | from :6 | ||||||
|  | M 100644 :7 delta | ||||||
|  |  | ||||||
							
								
								
									
										58
									
								
								test/expected/encoding/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								test/expected/encoding/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | |||||||
|  | changeset:   6674f1c866b5c428db4acde16404c14077889646 | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      7e9fd3fd2f75d7de4bf3d77c47f192a51927ac28 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    ea49f93388380ead5601c8fcbfa187516e7c2ed8 | ||||||
|  | user:        tést èncödîng <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      delta | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add déltà | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   7e9fd3fd2f75d7de4bf3d77c47f192a51927ac28 | ||||||
|  | phase:       draft | ||||||
|  | parent:      99c5adad03b9a9935e181f4be91ff7693a790110 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    f580e7da3673c137370da2b931a1dee83590d7b4 | ||||||
|  | user:        tést èncödîng <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      gamma | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add gämmâ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   99c5adad03b9a9935e181f4be91ff7693a790110 | ||||||
|  | phase:       draft | ||||||
|  | parent:      1e3e49d2cc8feaad4942d100108f20f207742d3a | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    f0bd6fbafbaebe4bb59c35108428f6fce152431d | ||||||
|  | user:        tést èncödîng <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      beta | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   1e3e49d2cc8feaad4942d100108f20f207742d3a | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add älphà | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								test/expected/executable bit/log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/expected/executable bit/log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :3 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 19 | ||||||
|  | set executable bit | ||||||
|  | from :2 | ||||||
|  | M 100755 :1 alpha | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 21 | ||||||
|  | clear executable bit | ||||||
|  | from :3 | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
							
								
								
									
										46
									
								
								test/expected/executable bit/output
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								test/expected/executable bit/output
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | changeset:   1efb93106a36bf71352ab04e769a3422522cf946 | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      d7cae8b1fdab97568ba5eca44ca2bf5a44d7c394 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    51e6255d794f794a8c4e0f03edf264444e3c5ce7 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files:       alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | clear executable bit | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   d7cae8b1fdab97568ba5eca44ca2bf5a44d7c394 | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    e4bf4ef5e9aea7a6a57573e533a5519bd062f144 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files:       alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | set executable bit | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 644   alpha | ||||||
|  | 644   alpha | ||||||
							
								
								
									
										60
									
								
								test/expected/file removal/log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								test/expected/file removal/log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 5 | ||||||
|  | beta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 9 | ||||||
|  | add beta | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 beta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 5 | ||||||
|  | blah | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 8 | ||||||
|  | add foo | ||||||
|  | from :4 | ||||||
|  | M 100644 :5 foo/bar | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :7 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 13 | ||||||
|  | remove alpha | ||||||
|  | from :6 | ||||||
|  | D alpha | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :8 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 15 | ||||||
|  | remove foo/bar | ||||||
|  | from :7 | ||||||
|  | D foo/bar | ||||||
|  |  | ||||||
							
								
								
									
										75
									
								
								test/expected/file removal/output
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								test/expected/file removal/output
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | |||||||
|  | changeset:   54f595cbdf1f516dc3b2b25faa6f051aae712f5d | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      7fe32a9185c6d37db430ee5248cdb2ae66582478 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    3f83f42fa00fb0cac14a83aa48baac2f287a9329 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files-:      foo/bar | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | remove foo/bar | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   7fe32a9185c6d37db430ee5248cdb2ae66582478 | ||||||
|  | phase:       draft | ||||||
|  | parent:      a21fd0b26a555427c2ea72f8ed37190f6216f705 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    cd10925837609b99d345c44c85bd1f73d742cbbc | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files-:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | remove alpha | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   a21fd0b26a555427c2ea72f8ed37190f6216f705 | ||||||
|  | phase:       draft | ||||||
|  | parent:      7cd99375c843931bd8959b766a94e050f428512b | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    a6ee442a94bfc6fb0b7d717183bb8b4534ca4ccd | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      foo/bar | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add foo | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   7cd99375c843931bd8959b766a94e050f428512b | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    f0bd6fbafbaebe4bb59c35108428f6fce152431d | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      beta | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
|  | beta | ||||||
|  | foo/bar | ||||||
|  | beta | ||||||
							
								
								
									
										32
									
								
								test/expected/git tags/log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/expected/git tags/log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | changeset:   7cd99375c843931bd8959b766a94e050f428512b | ||||||
|  | bookmark:    master | ||||||
|  | tag:         beta | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    f0bd6fbafbaebe4bb59c35108428f6fce152431d | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      beta | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | tag:         alpha | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										141
									
								
								test/expected/hg author/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								test/expected/hg author/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,141 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/not-master | ||||||
|  | commit refs/heads/not-master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 5 | ||||||
|  | beta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author test <none@none> 0 +0000 | ||||||
|  | committer test <none@none> 0 +0000 | ||||||
|  | data 9 | ||||||
|  | add beta | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 beta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 11 | ||||||
|  | beta | ||||||
|  | gamma | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author test ext:(%20%28comment%29) <test@example.com> 0 +0000 | ||||||
|  | committer test ext:(%20%28comment%29) <test@example.com> 0 +0000 | ||||||
|  | data 12 | ||||||
|  | modify beta | ||||||
|  | from :4 | ||||||
|  | M 100644 :5 beta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :7 | ||||||
|  | data 6 | ||||||
|  | gamma | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :8 | ||||||
|  | author  <test@example.com> 0 +0000 | ||||||
|  | committer  <test@example.com> 0 +0000 | ||||||
|  | data 10 | ||||||
|  | add gamma | ||||||
|  | from :6 | ||||||
|  | M 100644 :7 gamma | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :9 | ||||||
|  | data 6 | ||||||
|  | delta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :10 | ||||||
|  | author name <test@example.com> 0 +0000 | ||||||
|  | committer name <test@example.com> 0 +0000 | ||||||
|  | data 10 | ||||||
|  | add delta | ||||||
|  | from :8 | ||||||
|  | M 100644 :9 delta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :11 | ||||||
|  | data 8 | ||||||
|  | epsilon | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :12 | ||||||
|  | author name <test@example.com> 0 +0000 | ||||||
|  | committer name <test@example.com> 0 +0000 | ||||||
|  | data 12 | ||||||
|  | add epsilon | ||||||
|  | from :10 | ||||||
|  | M 100644 :11 epsilon | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :13 | ||||||
|  | data 5 | ||||||
|  | zeta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :14 | ||||||
|  | author test <none@none> 0 +0000 | ||||||
|  | committer test <none@none> 0 +0000 | ||||||
|  | data 9 | ||||||
|  | add zeta | ||||||
|  | from :12 | ||||||
|  | M 100644 :13 zeta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :15 | ||||||
|  | data 4 | ||||||
|  | eta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :16 | ||||||
|  | author test <test@example.com> 0 +0000 | ||||||
|  | committer test <test@example.com> 0 +0000 | ||||||
|  | data 8 | ||||||
|  | add eta | ||||||
|  | from :14 | ||||||
|  | M 100644 :15 eta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :17 | ||||||
|  | data 6 | ||||||
|  | theta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :18 | ||||||
|  | author test ?test@example.com <test ?test@example.com> 0 +0000 | ||||||
|  | committer test ?test@example.com <test ?test@example.com> 0 +0000 | ||||||
|  | data 10 | ||||||
|  | add theta | ||||||
|  | from :16 | ||||||
|  | M 100644 :17 theta | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :19 | ||||||
|  | data 5 | ||||||
|  | iota | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :20 | ||||||
|  | author test ext:(%20example%20%3Cdot%3E%20com%3E) <test ?at> 0 +0000 | ||||||
|  | committer test ext:(%20example%20%3Cdot%3E%20com%3E) <test ?at> 0 +0000 | ||||||
|  | data 9 | ||||||
|  | add iota | ||||||
|  | from :18 | ||||||
|  | M 100644 :19 iota | ||||||
|  |  | ||||||
							
								
								
									
										134
									
								
								test/expected/hg author/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								test/expected/hg author/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | |||||||
|  | changeset:   307c03466a07cccafaafc991f36d695d6ad595f3 | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      5832614d351449a2f8d6f7ccbef4877c2b18cbe0 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    e8f1b3ae088bdd25e3570a4953ccb6b948524473 | ||||||
|  | user:        test <test ?at> example <dot> com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      iota | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add iota | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   5832614d351449a2f8d6f7ccbef4877c2b18cbe0 | ||||||
|  | phase:       draft | ||||||
|  | parent:      e52ded4aca5d210ed58c63158d64fb911876f345 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    7e4875db7e2970c529f462520121d333e514bf4d | ||||||
|  | user:        test ?test@example.com <test ?test@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      theta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add theta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   e52ded4aca5d210ed58c63158d64fb911876f345 | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a34ba7d552e8b73ad306baf1d1eb83de0f74c12 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    ef03e54a9916ac3158c9686503dd4f609c26b3ec | ||||||
|  | user:        test <test@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      eta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add eta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   9a34ba7d552e8b73ad306baf1d1eb83de0f74c12 | ||||||
|  | phase:       draft | ||||||
|  | parent:      6281edc25b9fe9538407726f044a9a61ac7ba5bc | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    616201b85baf7ed02d41f6a7deb04c52009d8483 | ||||||
|  | user:        test | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      zeta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add zeta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   6281edc25b9fe9538407726f044a9a61ac7ba5bc | ||||||
|  | phase:       draft | ||||||
|  | parent:      4c7841053c633cb51f8375555d08b6bea54fc4cb | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    c703b3d7be8a0638047142f57ff83d4e94b5d1fa | ||||||
|  | user:        name <test@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      epsilon | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add epsilon | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   4c7841053c633cb51f8375555d08b6bea54fc4cb | ||||||
|  | phase:       draft | ||||||
|  | parent:      fa8f26586397dd4797842e9300c8db221fe5514d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    300b54001cbfa5d027b4bccdb594ccb463adb55d | ||||||
|  | user:        name <test@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      delta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add delta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   fa8f26586397dd4797842e9300c8db221fe5514d | ||||||
|  | phase:       draft | ||||||
|  | parent:      2708ff417fb7e2c0a4f9596286c0a398553fa793 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    45b0c483a79307d14f7e234feb78776478f828ec | ||||||
|  | user:        <test@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      gamma | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add gamma | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   2708ff417fb7e2c0a4f9596286c0a398553fa793 | ||||||
|  | phase:       draft | ||||||
|  | parent:      8c51e5fe974fe1cc63a56bbfad343f9ede6bed30 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    c305998040b12e956b998318982c9eb92d2d7b28 | ||||||
|  | user:        test <test@example.com> (comment) | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files:       beta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | modify beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   8c51e5fe974fe1cc63a56bbfad343f9ede6bed30 | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    f0bd6fbafbaebe4bb59c35108428f6fce152431d | ||||||
|  | user:        test | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      beta | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | bookmark:    not-master | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										38
									
								
								test/expected/hg branch/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								test/expected/hg branch/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/not-master | ||||||
|  | commit refs/heads/not-master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :3 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 52 | ||||||
|  | rename alpha to beta | ||||||
|  |  | ||||||
|  | --HG-- | ||||||
|  | rename : alpha => beta | ||||||
|  | from :2 | ||||||
|  | D alpha | ||||||
|  | M 100644 :1 beta | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 44 | ||||||
|  | started branch gamma | ||||||
|  |  | ||||||
|  | --HG-- | ||||||
|  | branch : gamma | ||||||
|  | from :3 | ||||||
|  |  | ||||||
							
								
								
									
										44
									
								
								test/expected/hg branch/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								test/expected/hg branch/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | |||||||
|  | changeset:   3320583a8de0b31511f499a4ab3426bee1a7f478 | ||||||
|  | branch:      gamma | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      5889597089fea2d144989baa9427d1a080293fdb | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    e353b4d5282d044ad738398fd32d0b684d04a14b | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | extra:       branch=gamma | ||||||
|  | description: | ||||||
|  | started branch gamma | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   5889597089fea2d144989baa9427d1a080293fdb | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    e353b4d5282d044ad738398fd32d0b684d04a14b | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      beta | ||||||
|  | files-:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | rename alpha to beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | bookmark:    not-master | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										33
									
								
								test/expected/hg tags/output
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								test/expected/hg tags/output
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | alpha | ||||||
|  | changeset:   16869bbe54be9f8082a8aec346de09f6c05cf1de | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    26f8145fb5b20cc6f70dd131b646f95ab79738c0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      .hgtags | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | Added tag alpha for changeset 362b656574c3 | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | bookmark:    not-master | ||||||
|  | tag:         alpha | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 362b656574c3c9e89fa7f2d7a943091dc93bce4d alpha | ||||||
							
								
								
									
										51
									
								
								test/expected/merge conflict 1/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								test/expected/merge conflict 1/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 2 | ||||||
|  | A | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 7 | ||||||
|  | origin | ||||||
|  | M 100644 :1 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 2 | ||||||
|  | C | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 2 +0000 | ||||||
|  | committer A U Thor <author@example.com> 2 +0000 | ||||||
|  | data 5 | ||||||
|  | A->C | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 2 | ||||||
|  | B | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author A U Thor <author@example.com> 1 +0000 | ||||||
|  | committer A U Thor <author@example.com> 1 +0000 | ||||||
|  | data 5 | ||||||
|  | A->B | ||||||
|  | from :2 | ||||||
|  | M 100644 :5 afile | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :7 | ||||||
|  | author A U Thor <author@example.com> 3 +0000 | ||||||
|  | committer A U Thor <author@example.com> 3 +0000 | ||||||
|  | data 11 | ||||||
|  | merge to C | ||||||
|  | from :4 | ||||||
|  | merge :6 | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								test/expected/merge conflict 1/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								test/expected/merge conflict 1/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | |||||||
|  | changeset:   9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    331ac2e605f2e6092ccb3802244a65b71f3be726 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | origin | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    894f8ad9a84f743d52747963d0b9f4e9cf37d489 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:01 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->B | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   d585ac55494928500f510b965b878d47f9ee60f6 | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    6efc6bb8e097947aa212887bdb01fb89dfa3de13 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:02 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->C | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   c6ab734e24c39948e5a25713b48f4972c960ff8b | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      d585ac55494928500f510b965b878d47f9ee60f6 | ||||||
|  | parent:      ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | manifest:    96bedb13781f1b9d729a2210a530f0c5c68f42e6 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:03 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | merge to C | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										52
									
								
								test/expected/merge conflict 2/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								test/expected/merge conflict 2/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 2 | ||||||
|  | A | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 7 | ||||||
|  | origin | ||||||
|  | M 100644 :1 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 2 | ||||||
|  | C | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 2 +0000 | ||||||
|  | committer A U Thor <author@example.com> 2 +0000 | ||||||
|  | data 5 | ||||||
|  | A->C | ||||||
|  | from :2 | ||||||
|  | M 100644 :3 afile | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :5 | ||||||
|  | data 2 | ||||||
|  | B | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :6 | ||||||
|  | author A U Thor <author@example.com> 1 +0000 | ||||||
|  | committer A U Thor <author@example.com> 1 +0000 | ||||||
|  | data 5 | ||||||
|  | A->B | ||||||
|  | from :2 | ||||||
|  | M 100644 :5 afile | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :7 | ||||||
|  | author A U Thor <author@example.com> 3 +0000 | ||||||
|  | committer A U Thor <author@example.com> 3 +0000 | ||||||
|  | data 11 | ||||||
|  | merge to B | ||||||
|  | from :4 | ||||||
|  | merge :6 | ||||||
|  | M 100644 :5 afile | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								test/expected/merge conflict 2/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								test/expected/merge conflict 2/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,54 @@ | |||||||
|  | changeset:   9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    331ac2e605f2e6092ccb3802244a65b71f3be726 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | origin | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    894f8ad9a84f743d52747963d0b9f4e9cf37d489 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:01 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->B | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   d585ac55494928500f510b965b878d47f9ee60f6 | ||||||
|  | phase:       draft | ||||||
|  | parent:      9a6668f453c3003b71e11bb8d7572af57a7ce891 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    6efc6bb8e097947aa212887bdb01fb89dfa3de13 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:02 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | A->C | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   542b187b70e70dc759631d1065794f3c2c5a3e7b | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      d585ac55494928500f510b965b878d47f9ee60f6 | ||||||
|  | parent:      ead35d346ecb18ce9d9d54604ff62b41caa196ce | ||||||
|  | manifest:    0907d7dbc98790102fa6cb91b68b271ef0bc5b64 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:03 1970 +0000 | ||||||
|  | files:       afile | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | merge to B | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								test/expected/rename/git-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								test/expected/rename/git-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :3 | ||||||
|  | author A U Thor <author@example.com> 0 +0000 | ||||||
|  | committer A U Thor <author@example.com> 0 +0000 | ||||||
|  | data 52 | ||||||
|  | rename alpha to beta | ||||||
|  |  | ||||||
|  | --HG-- | ||||||
|  | rename : alpha => beta | ||||||
|  | from :2 | ||||||
|  | D alpha | ||||||
|  | M 100644 :1 beta | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								test/expected/rename/hg-log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								test/expected/rename/hg-log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | changeset:   a985b184598fd779e53576c65c5dd1d274736c73 | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      0558a161e3ca0d59f5f165e3182402d9f1e574a8 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    e353b4d5282d044ad738398fd32d0b684d04a14b | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      beta | ||||||
|  | files-:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | rename alpha to beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   0558a161e3ca0d59f5f165e3182402d9f1e574a8 | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Thu Jan 01 00:00:00 1970 +0000 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								test/expected/symlink/log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								test/expected/symlink/log
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | blob | ||||||
|  | mark :1 | ||||||
|  | data 6 | ||||||
|  | alpha | ||||||
|  |  | ||||||
|  | reset refs/heads/master | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :2 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 10 | ||||||
|  | add alpha | ||||||
|  | M 100644 :1 alpha | ||||||
|  |  | ||||||
|  | blob | ||||||
|  | mark :3 | ||||||
|  | data 5 | ||||||
|  | alpha | ||||||
|  | commit refs/heads/master | ||||||
|  | mark :4 | ||||||
|  | author A U Thor <author@example.com> 1167600600 +0230 | ||||||
|  | committer C O Mitter <committer@example.com> 1167600600 +0230 | ||||||
|  | data 9 | ||||||
|  | add beta | ||||||
|  | from :2 | ||||||
|  | M 120000 :3 beta | ||||||
|  |  | ||||||
							
								
								
									
										32
									
								
								test/expected/symlink/output
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/expected/symlink/output
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | |||||||
|  | changeset:   87cbc97576079d3dfef04c678bfc8ab69999ebdf | ||||||
|  | bookmark:    master | ||||||
|  | tag:         tip | ||||||
|  | phase:       draft | ||||||
|  | parent:      362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    4950f48a7f5b0ce6f31c2f4307e296dbac652026 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      beta | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add beta | ||||||
|  |  | ||||||
|  |  | ||||||
|  | changeset:   362b656574c3c9e89fa7f2d7a943091dc93bce4d | ||||||
|  | phase:       draft | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | parent:      -0000000000000000000000000000000000000000 | ||||||
|  | manifest:    8b8a0e87dfd7a0706c0524afa8ba67e20544cbf0 | ||||||
|  | user:        A U Thor <author@example.com> | ||||||
|  | date:        Mon Jan 01 00:00:00 2007 +0230 | ||||||
|  | files+:      alpha | ||||||
|  | extra:       branch=default | ||||||
|  | extra:       committer=C O Mitter <committer@example.com> 1167600600 -9000 | ||||||
|  | description: | ||||||
|  | add alpha | ||||||
|  |  | ||||||
|  |  | ||||||
|  | 644   alpha | ||||||
|  | 644 @ beta | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| #!/bin/sh | #!/bin/bash | ||||||
| # | # | ||||||
| # Copyright (c) 2016 Mark Nauwelaerts | # Copyright (c) 2016 Mark Nauwelaerts | ||||||
| # | # | ||||||
| @@ -8,8 +8,7 @@ | |||||||
|  |  | ||||||
| test_description='Test git-hg-helper' | test_description='Test git-hg-helper' | ||||||
|  |  | ||||||
| test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/ | . ./test-lib.sh | ||||||
| . "$TEST_DIRECTORY"/test-lib.sh |  | ||||||
|  |  | ||||||
| if ! test_have_prereq PYTHON | if ! test_have_prereq PYTHON | ||||||
| then | then | ||||||
| @@ -100,7 +99,7 @@ test_expect_success 'subcommand repo - with local proxy' ' | |||||||
| 	test_cmp expected actual | 	test_cmp expected actual | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'subcommands hg-rev and git-rev' ' | test_expect_success 'subcommands hg-rev and git-rev and mapfile' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && | 	test_when_finished "rm -rf gitrepo* hgrepo*" && | ||||||
|  |  | ||||||
| 	setup_repos && | 	setup_repos && | ||||||
| @@ -111,7 +110,9 @@ test_expect_success 'subcommands hg-rev and git-rev' ' | |||||||
| 	test -s rev-HEAD && | 	test -s rev-HEAD && | ||||||
| 	git-hg-helper hg-rev `cat rev-HEAD` > hg-HEAD && | 	git-hg-helper hg-rev `cat rev-HEAD` > hg-HEAD && | ||||||
| 	git-hg-helper git-rev `cat hg-HEAD` > git-HEAD && | 	git-hg-helper git-rev `cat hg-HEAD` > git-HEAD && | ||||||
| 	test_cmp rev-HEAD git-HEAD | 	git-hg-helper mapfile --output mapfile origin && | ||||||
|  | 	test_cmp rev-HEAD git-HEAD && | ||||||
|  | 	grep "`cat rev-HEAD` `cat hg-HEAD`" mapfile | ||||||
| 	) | 	) | ||||||
| ' | ' | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										380
									
								
								test/hg-git.t
									
									
									
									
									
								
							
							
						
						
									
										380
									
								
								test/hg-git.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| #!/bin/sh | #!/bin/bash | ||||||
| # | # | ||||||
| # Copyright (c) 2012 Felipe Contreras | # Copyright (c) 2012 Felipe Contreras | ||||||
| # | # | ||||||
| @@ -6,36 +6,24 @@ | |||||||
| # https://bitbucket.org/durin42/hg-git/src | # https://bitbucket.org/durin42/hg-git/src | ||||||
| # | # | ||||||
|  |  | ||||||
|  | # shellcheck disable=SC2016,SC2034,SC2086,SC2164,SC1091 | ||||||
|  |  | ||||||
| test_description='Test remote-hg output compared to hg-git' | test_description='Test remote-hg output compared to hg-git' | ||||||
|  |  | ||||||
| test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/ | . ./test-lib.sh | ||||||
| . "$TEST_DIRECTORY"/test-lib.sh |  | ||||||
|  |  | ||||||
| if ! test_have_prereq PYTHON | export EXPECTED_DIR="$SHARNESS_TEST_DIRECTORY/expected" | ||||||
| then |  | ||||||
| 	skip_all='skipping remote-hg tests; python with mercurial not available' |  | ||||||
| 	test_done |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if "$PYTHON" -c 'import hggit' > /dev/null 2>&1 | git_clone () { | ||||||
| then |  | ||||||
| 	hggit=hggit |  | ||||||
| elif "$PYTHON" -c 'import hgext.git' > /dev/null 2>&1 |  | ||||||
| then |  | ||||||
| 	hggit=hgext.git |  | ||||||
| else |  | ||||||
| 	skip_all='skipping remote-hg tests; hg-git not available' |  | ||||||
| 	test_done |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| # clone to a git repo with git |  | ||||||
| git_clone_git () { |  | ||||||
| 	git clone -q "hg::$1" $2 && | 	git clone -q "hg::$1" $2 && | ||||||
| 	(cd $2 && git checkout master && git branch -D default) | 	( | ||||||
|  | 	cd $2 && | ||||||
|  | 	git checkout master && | ||||||
|  | 	{ git branch -D default || true ;} | ||||||
|  | 	) | ||||||
| } | } | ||||||
|  |  | ||||||
| # clone to an hg repo with git | hg_clone () { | ||||||
| hg_clone_git () { |  | ||||||
| 	( | 	( | ||||||
| 	hg init $2 && | 	hg init $2 && | ||||||
| 	hg -R $2 bookmark -i master && | 	hg -R $2 bookmark -i master && | ||||||
| @@ -46,83 +34,98 @@ hg_clone_git () { | |||||||
| 	(cd $2 && hg -q update) | 	(cd $2 && hg -q update) | ||||||
| } | } | ||||||
|  |  | ||||||
| # clone to a git repo with hg | hg_push () { | ||||||
| git_clone_hg () { |  | ||||||
| 	( |  | ||||||
| 	git init -q $2 && |  | ||||||
| 	cd $1 && |  | ||||||
| 	hg bookmark -i -f -r tip master && |  | ||||||
| 	hg -q push -r master ../$2 || true |  | ||||||
| 	) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # clone to an hg repo with hg |  | ||||||
| hg_clone_hg () { |  | ||||||
| 	hg -q clone $1 $2 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # push an hg repo with git |  | ||||||
| hg_push_git () { |  | ||||||
| 	( | 	( | ||||||
| 	cd $2 | 	cd $2 | ||||||
| 	git checkout -q -b tmp && | 	git checkout -q -b tmp && | ||||||
| 	git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' && | 	git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' && | ||||||
| 	git branch -D default && | 	git branch -D default && | ||||||
| 	git checkout -q @{-1} && | 	git checkout -q '@{-1}' && | ||||||
| 	git branch -q -D tmp 2> /dev/null || true | 	{ git branch -q -D tmp 2> /dev/null || true ;} | ||||||
| 	) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| # push an hg git repo with hg |  | ||||||
| hg_push_hg () { |  | ||||||
| 	( |  | ||||||
| 	cd $1 && |  | ||||||
| 	hg -q push ../$2 || true |  | ||||||
| 	) | 	) | ||||||
| } | } | ||||||
|  |  | ||||||
| hg_log () { | hg_log () { | ||||||
| 	hg -R $1 log --graph --debug > log && | 	hg -R $1 log --debug -r 'sort(tip:0, date)' | | ||||||
| 	grep -v 'tag: *default/' log | 		sed -e '/tag: *default/d' -e 's/[0-9]\+:\([0-9a-f]\{40\}\)/\1/' | ||||||
| } | } | ||||||
|  |  | ||||||
| git_log () { | git_log () { | ||||||
| 	git --git-dir=$1/.git fast-export --branches | 	git -C $1 fast-export --branches | ||||||
|  | } | ||||||
|  |  | ||||||
|  | test_cmp_expected () { | ||||||
|  | 	test_cmp "$EXPECTED_DIR/$test_id/$1" "$1" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | cmp_hg_to_git_log () { | ||||||
|  | 	hg_log hgrepo2 > hg-log && | ||||||
|  | 	git_log gitrepo > git-log && | ||||||
|  |  | ||||||
|  | 	test_cmp_expected hg-log && | ||||||
|  | 	test_cmp_expected git-log | ||||||
|  | } | ||||||
|  |  | ||||||
|  | cmp_hg_to_git_log_hgrepo1 () { | ||||||
|  | 	git_clone hgrepo1 gitrepo && | ||||||
|  | 	hg_clone gitrepo hgrepo2 && | ||||||
|  |  | ||||||
|  | 	cmp_hg_to_git_log | ||||||
|  | } | ||||||
|  |  | ||||||
|  | cmp_hg_to_git_manifest () { | ||||||
|  | 	( | ||||||
|  | 	hg_clone gitrepo hgrepo && | ||||||
|  | 	cd hgrepo && | ||||||
|  | 	hg_log . && | ||||||
|  | 	eval "$1" | ||||||
|  | 	) > output && | ||||||
|  |  | ||||||
|  | 	git_clone hgrepo gitrepo2 && | ||||||
|  | 	git_log gitrepo2 > log && | ||||||
|  |  | ||||||
|  | 	test_cmp_expected output && | ||||||
|  | 	test_cmp_expected log | ||||||
| } | } | ||||||
|  |  | ||||||
| setup () { | setup () { | ||||||
| 	cat > "$HOME"/.hgrc <<-EOF && | 	cat > "$HOME"/.hgrc <<-EOF | ||||||
| 	[ui] | 	[ui] | ||||||
| 	username = A U Thor <author@example.com> | 	username = A U Thor <author@example.com> | ||||||
| 	[defaults] | 	[defaults] | ||||||
| 	backout = -d "0 0" |  | ||||||
| 	commit = -d "0 0" | 	commit = -d "0 0" | ||||||
| 	debugrawcommit = -d "0 0" |  | ||||||
| 	tag = -d "0 0" | 	tag = -d "0 0" | ||||||
| 	[extensions] |  | ||||||
| 	$hggit = |  | ||||||
| 	graphlog = |  | ||||||
| 	[git] |  | ||||||
| 	debugextrainmessage = 1 |  | ||||||
| 	EOF | 	EOF | ||||||
| 	git config --global receive.denycurrentbranch warn |  | ||||||
| 	git config --global remote-hg.hg-git-compat true |  | ||||||
| 	git config --global remote-hg.track-branches false |  | ||||||
| 	git config --global remote-hg.shared-marks false |  | ||||||
|  |  | ||||||
| 	HGEDITOR=true | 	cat > "$HOME"/.gitconfig <<-EOF | ||||||
| 	HGMERGE=true | 	[remote-hg] | ||||||
|  | 		hg-git-compat = true | ||||||
|  | 		track-branches = false | ||||||
|  | 		# directly use local repo to avoid push (and hence phase issues) | ||||||
|  | 		shared-marks = false | ||||||
|  | 	EOF | ||||||
|  |  | ||||||
| 	GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" | 	export HGEDITOR=true | ||||||
| 	GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | 	export HGMERGE=true | ||||||
| 	export HGEDITOR HGMERGE GIT_AUTHOR_DATE GIT_COMMITTER_DATE |  | ||||||
|  | 	export GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" | ||||||
|  | 	export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" | ||||||
| } | } | ||||||
|  |  | ||||||
| setup | setup | ||||||
|  |  | ||||||
| test_expect_success 'rename' ' | # save old function | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && | eval "old_$(declare -f test_expect_success)" | ||||||
|  |  | ||||||
|  | test_expect_success () { | ||||||
|  | 	local req | ||||||
|  | 	test "$#" = 3 && { req=$1; shift; } || req= | ||||||
|  | 	test_id="$1" | ||||||
|  | 	old_test_expect_success "$req" "$1" " | ||||||
|  | 	test_when_finished \"rm -rf gitrepo* hgrepo*\" && $2" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | test_expect_success 'rename' ' | ||||||
| 	( | 	( | ||||||
| 	hg init hgrepo1 && | 	hg init hgrepo1 && | ||||||
| 	cd hgrepo1 && | 	cd hgrepo1 && | ||||||
| @@ -133,21 +136,10 @@ test_expect_success 'rename' ' | |||||||
| 	hg commit -m "rename alpha to beta" | 	hg commit -m "rename alpha to beta" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_log_hgrepo1 | ||||||
| 	do |  | ||||||
| 		git_clone_$x hgrepo1 gitrepo-$x && |  | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && |  | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'executable bit' ' | test_expect_success !WIN 'executable bit' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	git init -q gitrepo && | 	git init -q gitrepo && | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
| @@ -163,27 +155,10 @@ test_expect_success 'executable bit' ' | |||||||
| 	git commit -m "clear executable bit" | 	git commit -m "clear executable bit" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_manifest "hg manifest -v -r -1; hg manifest -v" | ||||||
| 	do |  | ||||||
| 		( |  | ||||||
| 		hg_clone_$x gitrepo hgrepo-$x && |  | ||||||
| 		cd hgrepo-$x && |  | ||||||
| 		hg_log . && |  | ||||||
| 		hg manifest -r 1 -v && |  | ||||||
| 		hg manifest -v |  | ||||||
| 		) > "output-$x" && |  | ||||||
|  |  | ||||||
| 		git_clone_$x hgrepo-$x gitrepo2-$x && |  | ||||||
| 		git_log gitrepo2-$x > "log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp output-hg output-git && |  | ||||||
| 	test_cmp log-hg log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'symlink' ' | test_expect_success !WIN 'symlink' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	git init -q gitrepo && | 	git init -q gitrepo && | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
| @@ -195,26 +170,10 @@ test_expect_success 'symlink' ' | |||||||
| 	git commit -m "add beta" | 	git commit -m "add beta" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_manifest "hg manifest -v" | ||||||
| 	do |  | ||||||
| 		( |  | ||||||
| 		hg_clone_$x gitrepo hgrepo-$x && |  | ||||||
| 		cd hgrepo-$x && |  | ||||||
| 		hg_log . && |  | ||||||
| 		hg manifest -v |  | ||||||
| 		) > "output-$x" && |  | ||||||
|  |  | ||||||
| 		git_clone_$x hgrepo-$x gitrepo2-$x && |  | ||||||
| 		git_log gitrepo2-$x > "log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp output-hg output-git && |  | ||||||
| 	test_cmp log-hg log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'merge conflict 1' ' | test_expect_success 'merge conflict 1' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	hg init hgrepo1 && | 	hg init hgrepo1 && | ||||||
| 	cd hgrepo1 && | 	cd hgrepo1 && | ||||||
| @@ -223,33 +182,22 @@ test_expect_success 'merge conflict 1' ' | |||||||
| 	hg ci -m "origin" && | 	hg ci -m "origin" && | ||||||
|  |  | ||||||
| 	echo B > afile && | 	echo B > afile && | ||||||
| 	hg ci -m "A->B" && | 	hg ci -m "A->B" -d "1 0" && | ||||||
|  |  | ||||||
| 	hg up -r0 && | 	hg up -r0 && | ||||||
| 	echo C > afile && | 	echo C > afile && | ||||||
| 	hg ci -m "A->C" && | 	hg ci -m "A->C" -d "2 0" && | ||||||
|  |  | ||||||
| 	hg merge -r1 && | 	hg merge -r1 && | ||||||
| 	echo C > afile && | 	echo C > afile && | ||||||
| 	hg resolve -m afile && | 	hg resolve -m afile && | ||||||
| 	hg ci -m "merge to C" | 	hg ci -m "merge to C" -d "3 0" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_log_hgrepo1 | ||||||
| 	do |  | ||||||
| 		git_clone_$x hgrepo1 gitrepo-$x && |  | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && |  | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'merge conflict 2' ' | test_expect_success 'merge conflict 2' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	hg init hgrepo1 && | 	hg init hgrepo1 && | ||||||
| 	cd hgrepo1 && | 	cd hgrepo1 && | ||||||
| @@ -258,33 +206,22 @@ test_expect_success 'merge conflict 2' ' | |||||||
| 	hg ci -m "origin" && | 	hg ci -m "origin" && | ||||||
|  |  | ||||||
| 	echo B > afile && | 	echo B > afile && | ||||||
| 	hg ci -m "A->B" && | 	hg ci -m "A->B" -d "1 0" && | ||||||
|  |  | ||||||
| 	hg up -r0 && | 	hg up -r0 && | ||||||
| 	echo C > afile && | 	echo C > afile && | ||||||
| 	hg ci -m "A->C" && | 	hg ci -m "A->C" -d "2 0" && | ||||||
|  |  | ||||||
| 	hg merge -r1 || true && | 	hg merge -r1 || true && | ||||||
| 	echo B > afile && | 	echo B > afile && | ||||||
| 	hg resolve -m afile && | 	hg resolve -m afile && | ||||||
| 	hg ci -m "merge to B" | 	hg ci -m "merge to B" -d "3 0" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_log_hgrepo1 | ||||||
| 	do |  | ||||||
| 		git_clone_$x hgrepo1 gitrepo-$x && |  | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && |  | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'converged merge' ' | test_expect_success 'converged merge' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	hg init hgrepo1 && | 	hg init hgrepo1 && | ||||||
| 	cd hgrepo1 && | 	cd hgrepo1 && | ||||||
| @@ -293,34 +230,23 @@ test_expect_success 'converged merge' ' | |||||||
| 	hg ci -m "origin" && | 	hg ci -m "origin" && | ||||||
|  |  | ||||||
| 	echo B > afile && | 	echo B > afile && | ||||||
| 	hg ci -m "A->B" && | 	hg ci -m "A->B" -d "1 0" && | ||||||
|  |  | ||||||
| 	echo C > afile && | 	echo C > afile && | ||||||
| 	hg ci -m "B->C" && | 	hg ci -m "B->C" -d "2 0" && | ||||||
|  |  | ||||||
| 	hg up -r0 && | 	hg up -r0 && | ||||||
| 	echo C > afile && | 	echo C > afile && | ||||||
| 	hg ci -m "A->C" && | 	hg ci -m "A->C" -d "3 0" && | ||||||
|  |  | ||||||
| 	hg merge -r2 || true && | 	hg merge -r2 || true && | ||||||
| 	hg ci -m "merge" | 	hg ci -m "merge" -d "4 0" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_log_hgrepo1 | ||||||
| 	do |  | ||||||
| 		git_clone_$x hgrepo1 gitrepo-$x && |  | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && |  | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'encoding' ' | test_expect_success 'encoding' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	git init -q gitrepo && | 	git init -q gitrepo && | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
| @@ -345,22 +271,17 @@ test_expect_success 'encoding' ' | |||||||
| 	git commit -m "add déltà" | 	git commit -m "add déltà" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	hg_clone gitrepo hgrepo && | ||||||
| 	do | 	git_clone hgrepo gitrepo2 && | ||||||
| 		hg_clone_$x gitrepo hgrepo-$x && |  | ||||||
| 		git_clone_$x hgrepo-$x gitrepo2-$x && |  | ||||||
|  |  | ||||||
| 		HGENCODING=utf-8 hg_log hgrepo-$x > "hg-log-$x" && | 	HGENCODING=utf-8 hg_log hgrepo > hg-log && | ||||||
| 		git_log gitrepo2-$x > "git-log-$x" | 	git_log gitrepo2 > git-log && | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && | 	test_cmp_expected hg-log && | ||||||
| 	test_cmp git-log-hg git-log-git | 	test_cmp_expected git-log | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'file removal' ' | test_expect_success 'file removal' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	git init -q gitrepo && | 	git init -q gitrepo && | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
| @@ -380,27 +301,10 @@ test_expect_success 'file removal' ' | |||||||
| 	git commit -m "remove foo/bar" | 	git commit -m "remove foo/bar" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	cmp_hg_to_git_manifest "hg manifest -r 3; hg manifest" | ||||||
| 	do |  | ||||||
| 		( |  | ||||||
| 		hg_clone_$x gitrepo hgrepo-$x && |  | ||||||
| 		cd hgrepo-$x && |  | ||||||
| 		hg_log . && |  | ||||||
| 		hg manifest -r 3 && |  | ||||||
| 		hg manifest |  | ||||||
| 		) > "output-$x" && |  | ||||||
|  |  | ||||||
| 		git_clone_$x hgrepo-$x gitrepo2-$x && |  | ||||||
| 		git_log gitrepo2-$x > "log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp output-hg output-git && |  | ||||||
| 	test_cmp log-hg log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'git tags' ' | test_expect_success 'git tags' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 	git init -q gitrepo && | 	git init -q gitrepo && | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
| @@ -416,23 +320,16 @@ test_expect_success 'git tags' ' | |||||||
| 	git tag -a -m "added tag beta" beta | 	git tag -a -m "added tag beta" beta | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	for x in hg git | 	hg_clone gitrepo hgrepo && | ||||||
| 	do | 	hg_log hgrepo > log && | ||||||
| 		hg_clone_$x gitrepo hgrepo-$x && |  | ||||||
| 		hg_log hgrepo-$x > "log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp log-hg log-git | 	test_cmp_expected log | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'hg author' ' | test_expect_success 'hg author' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	for x in hg git |  | ||||||
| 	do |  | ||||||
| 	( | 	( | ||||||
| 		git init -q gitrepo-$x && | 	git init -q gitrepo && | ||||||
| 		cd gitrepo-$x && | 	cd gitrepo && | ||||||
|  |  | ||||||
| 	echo alpha > alpha && | 	echo alpha > alpha && | ||||||
| 	git add alpha && | 	git add alpha && | ||||||
| @@ -441,8 +338,8 @@ test_expect_success 'hg author' ' | |||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo-$x && | 	hg_clone gitrepo hgrepo && | ||||||
| 		cd hgrepo-$x && | 	cd hgrepo && | ||||||
|  |  | ||||||
| 	hg co master && | 	hg co master && | ||||||
| 	echo beta > beta && | 	echo beta > beta && | ||||||
| @@ -481,25 +378,16 @@ test_expect_success 'hg author' ' | |||||||
| 	hg commit -u "test <test <at> example <dot> com>" -m "add iota" | 	hg commit -u "test <test <at> example <dot> com>" -m "add iota" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 		hg_push_$x hgrepo-$x gitrepo-$x && | 	hg_push hgrepo gitrepo && | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && | 	hg_clone gitrepo hgrepo2 && | ||||||
|  |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && | 	cmp_hg_to_git_log | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'hg branch' ' | test_expect_success 'hg branch' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	for x in hg git |  | ||||||
| 	do |  | ||||||
| 	( | 	( | ||||||
| 		git init -q gitrepo-$x && | 	git init -q gitrepo && | ||||||
| 		cd gitrepo-$x && | 	cd gitrepo && | ||||||
|  |  | ||||||
| 	echo alpha > alpha && | 	echo alpha > alpha && | ||||||
| 	git add alpha && | 	git add alpha && | ||||||
| @@ -508,9 +396,9 @@ test_expect_success 'hg branch' ' | |||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo-$x && | 	hg_clone gitrepo hgrepo && | ||||||
|  |  | ||||||
| 		cd hgrepo-$x && | 	cd hgrepo && | ||||||
| 	hg -q co master && | 	hg -q co master && | ||||||
| 	hg mv alpha beta && | 	hg mv alpha beta && | ||||||
| 	hg -q commit -m "rename alpha to beta" && | 	hg -q commit -m "rename alpha to beta" && | ||||||
| @@ -518,25 +406,16 @@ test_expect_success 'hg branch' ' | |||||||
| 	hg -q commit -m "started branch gamma" | 	hg -q commit -m "started branch gamma" | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 		hg_push_$x hgrepo-$x gitrepo-$x && | 	hg_push hgrepo gitrepo && | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && | 	hg_clone gitrepo hgrepo2 && | ||||||
|  |  | ||||||
| 		hg_log hgrepo2-$x > "hg-log-$x" && | 	cmp_hg_to_git_log | ||||||
| 		git_log gitrepo-$x > "git-log-$x" |  | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp hg-log-hg hg-log-git && |  | ||||||
| 	test_cmp git-log-hg git-log-git |  | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success 'hg tags' ' | test_expect_success 'hg tags' ' | ||||||
| 	test_when_finished "rm -rf gitrepo* hgrepo*" && |  | ||||||
|  |  | ||||||
| 	for x in hg git |  | ||||||
| 	do |  | ||||||
| 	( | 	( | ||||||
| 		git init -q gitrepo-$x && | 	git init -q gitrepo && | ||||||
| 		cd gitrepo-$x && | 	cd gitrepo && | ||||||
|  |  | ||||||
| 	echo alpha > alpha && | 	echo alpha > alpha && | ||||||
| 	git add alpha && | 	git add alpha && | ||||||
| @@ -545,24 +424,23 @@ test_expect_success 'hg tags' ' | |||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo-$x && | 	hg_clone gitrepo hgrepo && | ||||||
|  |  | ||||||
| 		cd hgrepo-$x && | 	cd hgrepo && | ||||||
| 	hg co master && | 	hg co master && | ||||||
| 	hg tag alpha | 	hg tag alpha | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 		hg_push_$x hgrepo-$x gitrepo-$x && | 	hg_push hgrepo gitrepo && | ||||||
| 		hg_clone_$x gitrepo-$x hgrepo2-$x && | 	hg_clone gitrepo hgrepo2 && | ||||||
|  |  | ||||||
| 	( | 	( | ||||||
| 		git --git-dir=gitrepo-$x/.git tag -l && | 	git -C gitrepo tag -l && | ||||||
| 		hg_log hgrepo2-$x && | 	hg_log hgrepo2 && | ||||||
| 		cat hgrepo2-$x/.hgtags | 	cat hgrepo2/.hgtags | ||||||
| 		) > "output-$x" | 	) > output && | ||||||
| 	done && |  | ||||||
|  |  | ||||||
| 	test_cmp output-hg output-git | 	test_cmp_expected output | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_done | test_done | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
| CAPABILITY_PUSH=t | CAPABILITY_PUSH=t | ||||||
|  |  | ||||||
| test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/ | . ./main.t | ||||||
| . "$TEST_DIRECTORY"/main.t |  | ||||||
|  |  | ||||||
|  |  | ||||||
| # .. and some push mode only specific tests | # .. and some push mode only specific tests | ||||||
|   | |||||||
							
								
								
									
										95
									
								
								test/main.t
									
									
									
									
									
								
							
							
						
						
									
										95
									
								
								test/main.t
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| #!/bin/sh | #!/bin/bash | ||||||
| # | # | ||||||
| # Copyright (c) 2012 Felipe Contreras | # Copyright (c) 2012 Felipe Contreras | ||||||
| # | # | ||||||
| @@ -8,8 +8,7 @@ | |||||||
|  |  | ||||||
| test_description='Test remote-hg' | test_description='Test remote-hg' | ||||||
|  |  | ||||||
| test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=$(dirname $0)/ | . ./test-lib.sh | ||||||
| . "$TEST_DIRECTORY"/test-lib.sh |  | ||||||
|  |  | ||||||
| if test "$CAPABILITY_PUSH" = "t" | if test "$CAPABILITY_PUSH" = "t" | ||||||
| then | then | ||||||
| @@ -20,12 +19,6 @@ else | |||||||
| 	git config --global remote-hg.capability-push false | 	git config --global remote-hg.capability-push false | ||||||
| fi | fi | ||||||
|  |  | ||||||
| if ! test_have_prereq PYTHON |  | ||||||
| then |  | ||||||
| 	skip_all='skipping remote-hg tests; python with mercurial not available' |  | ||||||
| 	test_done |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| check () { | check () { | ||||||
| 	echo $3 > expected && | 	echo $3 > expected && | ||||||
| 	git --git-dir=$1/.git log --format='%s' -1 $2 > actual && | 	git --git-dir=$1/.git log --format='%s' -1 $2 > actual && | ||||||
| @@ -275,6 +268,41 @@ test_expect_success 'strip' ' | |||||||
| 	test_cmp actual expected | 	test_cmp actual expected | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | test_expect_success 'dotfiles' ' | ||||||
|  | 	test_when_finished "rm -rf hgrepo gitrepo" && | ||||||
|  |  | ||||||
|  | 	( | ||||||
|  | 	hg init hgrepo && | ||||||
|  | 	cd hgrepo && | ||||||
|  |  | ||||||
|  | 	echo one >.git && | ||||||
|  | 	echo ONE >.GIT && | ||||||
|  | 	mkdir a && echo two > a/.gitmodules && | ||||||
|  | 	hg add .git .GIT a/.gitmodules && | ||||||
|  | 	hg commit -m zero | ||||||
|  | 	) && | ||||||
|  |  | ||||||
|  | 	git clone "hg::hgrepo" gitrepo && | ||||||
|  | 	test_cmp gitrepo/.git_ hgrepo/.git && | ||||||
|  | 	test_cmp gitrepo/.GIT_ hgrepo/.GIT && | ||||||
|  | 	test_cmp gitrepo/a/.gitmodules_ hgrepo/a/.gitmodules && | ||||||
|  |  | ||||||
|  | 	( | ||||||
|  | 	cd gitrepo && | ||||||
|  | 	echo three >.git_ && | ||||||
|  | 	echo THREE >.GIT && | ||||||
|  | 	echo four >a/.gitmodules_ && | ||||||
|  | 	git add .git_ .GIT_ a/.gitmodules_ && | ||||||
|  | 	git commit -m one && | ||||||
|  | 	git push | ||||||
|  | 	) && | ||||||
|  |  | ||||||
|  | 	hg -R hgrepo update && | ||||||
|  | 	test_cmp gitrepo/.git_ hgrepo/.git && | ||||||
|  | 	test_cmp gitrepo/.GIT_ hgrepo/.GIT && | ||||||
|  | 	test_cmp gitrepo/a/.gitmodules_ hgrepo/a/.gitmodules | ||||||
|  | ' | ||||||
|  |  | ||||||
| test_expect_success 'remote push with master bookmark' ' | test_expect_success 'remote push with master bookmark' ' | ||||||
| 	test_when_finished "rm -rf hgrepo gitrepo*" && | 	test_when_finished "rm -rf hgrepo gitrepo*" && | ||||||
|  |  | ||||||
| @@ -513,7 +541,7 @@ else | |||||||
| test_expect_failure "$testcopyrenamedesc" "$testcopyrename" | test_expect_failure "$testcopyrenamedesc" "$testcopyrename" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| test_expect_success 'fetch special filenames' ' | test_expect_success !WIN 'fetch special filenames' ' | ||||||
| 	test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" && | 	test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" && | ||||||
|  |  | ||||||
| 	LC_ALL=en_US.UTF-8 | 	LC_ALL=en_US.UTF-8 | ||||||
| @@ -652,6 +680,10 @@ test_expect_success 'remote big push' ' | |||||||
| 	( | 	( | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
|  |  | ||||||
|  | 	if test "$CAPABILITY_PUSH" = "t" | ||||||
|  | 	then | ||||||
|  | 		# cap push handles refs one by one | ||||||
|  | 		# so it will still correctly report several ok | ||||||
| 		check_push 1 --all <<-\EOF | 		check_push 1 --all <<-\EOF | ||||||
| 		master | 		master | ||||||
| 		good_bmark | 		good_bmark | ||||||
| @@ -662,6 +694,13 @@ test_expect_success 'remote big push' ' | |||||||
| 		bad_bmark2:non-fast-forward | 		bad_bmark2:non-fast-forward | ||||||
| 		branches/bad_branch:non-fast-forward | 		branches/bad_branch:non-fast-forward | ||||||
| 		EOF | 		EOF | ||||||
|  | 	else | ||||||
|  | 		check_push 1 --all <<-\EOF | ||||||
|  | 		bad_bmark1:non-fast-forward | ||||||
|  | 		bad_bmark2:non-fast-forward | ||||||
|  | 		branches/bad_branch:non-fast-forward | ||||||
|  | 		EOF | ||||||
|  | 	fi | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
| 	if test "$CAPABILITY_PUSH" = "t" | 	if test "$CAPABILITY_PUSH" = "t" | ||||||
| @@ -675,7 +714,8 @@ test_expect_success 'remote big push' ' | |||||||
| 		check_bookmark hgrepo good_bmark three && | 		check_bookmark hgrepo good_bmark three && | ||||||
| 		check_bookmark hgrepo bad_bmark1 one && | 		check_bookmark hgrepo bad_bmark1 one && | ||||||
| 		check_bookmark hgrepo bad_bmark2 one && | 		check_bookmark hgrepo bad_bmark2 one && | ||||||
| 		check_bookmark hgrepo new_bmark six | 		check_bookmark hgrepo new_bmark six && | ||||||
|  | 		check gitrepo origin/master two | ||||||
| 	else | 	else | ||||||
| 		check_branch hgrepo default one && | 		check_branch hgrepo default one && | ||||||
| 		check_branch hgrepo good_branch "good branch" && | 		check_branch hgrepo good_branch "good branch" && | ||||||
| @@ -684,7 +724,8 @@ test_expect_success 'remote big push' ' | |||||||
| 		check_bookmark hgrepo good_bmark one && | 		check_bookmark hgrepo good_bmark one && | ||||||
| 		check_bookmark hgrepo bad_bmark1 one && | 		check_bookmark hgrepo bad_bmark1 one && | ||||||
| 		check_bookmark hgrepo bad_bmark2 one && | 		check_bookmark hgrepo bad_bmark2 one && | ||||||
| 		check_bookmark hgrepo new_bmark | 		check_bookmark hgrepo new_bmark && | ||||||
|  | 		check gitrepo origin/master one | ||||||
| 	fi | 	fi | ||||||
| ' | ' | ||||||
|  |  | ||||||
| @@ -734,12 +775,21 @@ test_expect_success 'remote big push non fast forward' ' | |||||||
| 	echo five > content && | 	echo five > content && | ||||||
| 	git commit -q -a -m five && | 	git commit -q -a -m five && | ||||||
|  |  | ||||||
| 	check_push 1 --all <<-\EOF && | 	if test "$CAPABILITY_PUSH" = "t" | ||||||
|  | 	then | ||||||
|  | 		check_push 1 --all <<-\EOF | ||||||
| 		master | 		master | ||||||
| 		good_bmark | 		good_bmark | ||||||
| 		bad_bmark:non-fast-forward | 		bad_bmark:non-fast-forward | ||||||
| 		branches/bad_branch:non-fast-forward | 		branches/bad_branch:non-fast-forward | ||||||
| 		EOF | 		EOF | ||||||
|  | 	else | ||||||
|  | 		# cap export now only report error cases | ||||||
|  | 		check_push 1 --all <<-\EOF | ||||||
|  | 		bad_bmark:non-fast-forward | ||||||
|  | 		branches/bad_branch:non-fast-forward | ||||||
|  | 		EOF | ||||||
|  | 	fi && | ||||||
|  |  | ||||||
| 	git fetch && | 	git fetch && | ||||||
|  |  | ||||||
| @@ -753,9 +803,8 @@ test_expect_success 'remote big push non fast forward' ' | |||||||
| 		branches/bad_branch:non-fast-forward | 		branches/bad_branch:non-fast-forward | ||||||
| 		EOF | 		EOF | ||||||
| 	else | 	else | ||||||
|  | 		# cap export now only report error cases | ||||||
| 		check_push 1 --all <<-\EOF | 		check_push 1 --all <<-\EOF | ||||||
| 		master |  | ||||||
| 		good_bmark |  | ||||||
| 		bad_bmark:non-fast-forward | 		bad_bmark:non-fast-forward | ||||||
| 		branches/bad_branch:non-fast-forward | 		branches/bad_branch:non-fast-forward | ||||||
| 		EOF | 		EOF | ||||||
| @@ -797,6 +846,7 @@ test_expect_success 'remote big push force' ' | |||||||
| 	fi | 	fi | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
|  | 	check gitrepo origin/master two && | ||||||
| 	check_branch hgrepo good_branch eight && | 	check_branch hgrepo good_branch eight && | ||||||
| 	check_branch hgrepo bad_branch nine && | 	check_branch hgrepo bad_branch nine && | ||||||
| 	check_branch hgrepo new_branch ten && | 	check_branch hgrepo new_branch ten && | ||||||
| @@ -814,7 +864,11 @@ test_expect_success 'remote big push dry-run' ' | |||||||
| 	( | 	( | ||||||
| 	cd gitrepo && | 	cd gitrepo && | ||||||
|  |  | ||||||
| 	check_push 1 --dry-run --all <<-\EOF && | 	if test "$CAPABILITY_PUSH" = "t" | ||||||
|  | 	then | ||||||
|  | 		# cap push handles refs one by one | ||||||
|  | 		# so it will still correctly report several ok | ||||||
|  | 		check_push 1 --dry-run --all <<-\EOF | ||||||
| 		master | 		master | ||||||
| 		good_bmark | 		good_bmark | ||||||
| 		branches/good_branch | 		branches/good_branch | ||||||
| @@ -824,6 +878,13 @@ test_expect_success 'remote big push dry-run' ' | |||||||
| 		bad_bmark2:non-fast-forward | 		bad_bmark2:non-fast-forward | ||||||
| 		branches/bad_branch:non-fast-forward | 		branches/bad_branch:non-fast-forward | ||||||
| 		EOF | 		EOF | ||||||
|  | 	else | ||||||
|  | 		check_push 1 --dry-run --all <<-\EOF | ||||||
|  | 		bad_bmark1:non-fast-forward | ||||||
|  | 		bad_bmark2:non-fast-forward | ||||||
|  | 		branches/bad_branch:non-fast-forward | ||||||
|  | 		EOF | ||||||
|  | 	fi && | ||||||
|  |  | ||||||
| 	check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-\EOF | 	check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-\EOF | ||||||
| 	master | 	master | ||||||
| @@ -834,6 +895,7 @@ test_expect_success 'remote big push dry-run' ' | |||||||
| 	EOF | 	EOF | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
|  | 	check gitrepo origin/master one && | ||||||
| 	check_branch hgrepo default one && | 	check_branch hgrepo default one && | ||||||
| 	check_branch hgrepo good_branch "good branch" && | 	check_branch hgrepo good_branch "good branch" && | ||||||
| 	check_branch hgrepo bad_branch "bad branch" && | 	check_branch hgrepo bad_branch "bad branch" && | ||||||
| @@ -878,6 +940,7 @@ test_expect_success 'remote big push force dry-run' ' | |||||||
| 	fi | 	fi | ||||||
| 	) && | 	) && | ||||||
|  |  | ||||||
|  | 	check gitrepo origin/master one && | ||||||
| 	check_branch hgrepo default one && | 	check_branch hgrepo default one && | ||||||
| 	check_branch hgrepo good_branch "good branch" && | 	check_branch hgrepo good_branch "good branch" && | ||||||
| 	check_branch hgrepo bad_branch "bad branch" && | 	check_branch hgrepo bad_branch "bad branch" && | ||||||
|   | |||||||
| @@ -1,8 +1,10 @@ | |||||||
| #!/bin/sh | #!/bin/bash | ||||||
|  |  | ||||||
|  | : "${SHARNESS_TEST_SRCDIR:=$(cd "$(dirname "${BASH_SOURCE-$0}")" && pwd)}" | ||||||
|  |  | ||||||
| if [ -z "$SHARNESS" ] ; then | if [ -z "$SHARNESS" ] ; then | ||||||
| 	for d in \ | 	for d in \ | ||||||
| 		"." \ | 		"$SHARNESS_TEST_SRCDIR" \ | ||||||
| 		"$HOME/share/sharness" \ | 		"$HOME/share/sharness" \ | ||||||
| 		"/usr/local/share/sharness" \ | 		"/usr/local/share/sharness" \ | ||||||
| 		"/usr/share/sharness" | 		"/usr/share/sharness" | ||||||
| @@ -27,16 +29,17 @@ SHARNESS_BUILD_DIRECTORY="$(mktemp -d)" | |||||||
| export PATH="${PATH#*:}" | export PATH="${PATH#*:}" | ||||||
| rmdir "$SHARNESS_BUILD_DIRECTORY" | rmdir "$SHARNESS_BUILD_DIRECTORY" | ||||||
|  |  | ||||||
| if [ -n "$PYTHON" ] && "$PYTHON" -c 'import mercurial' 2> /dev/null ; then | if [ -z "$TEST_INSTALLED_SCRIPTS" ] ; then | ||||||
|  | 	if [ -n "$PYTHON" ] && "$PYTHON" -c 'import mercurial' 2> /dev/null ; then | ||||||
| 		: Use chosen Python version | 		: Use chosen Python version | ||||||
| elif python3 -c 'import mercurial' 2> /dev/null ; then | 	elif python3 -c 'import mercurial' 2> /dev/null ; then | ||||||
| 		PYTHON=python3 | 		PYTHON=python3 | ||||||
| elif python2 -c 'import mercurial' 2> /dev/null ; then | 	elif python2 -c 'import mercurial' 2> /dev/null ; then | ||||||
| 		PYTHON=python2 | 		PYTHON=python2 | ||||||
| elif python -c 'import mercurial' 2> /dev/null ; then | 	elif python -c 'import mercurial' 2> /dev/null ; then | ||||||
| 		PYTHON=python | 		PYTHON=python | ||||||
| fi | 	fi | ||||||
| if [ -n "$PYTHON" ] ; then | 	if [ -n "$PYTHON" ] ; then | ||||||
| 		test_set_prereq PYTHON | 		test_set_prereq PYTHON | ||||||
|  |  | ||||||
| 		# Change shebang on a copy of scripts to chosen Python version | 		# Change shebang on a copy of scripts to chosen Python version | ||||||
| @@ -49,6 +52,10 @@ if [ -n "$PYTHON" ] ; then | |||||||
| 		done | 		done | ||||||
| 		export PATH="$TEST_BIN${PATH:+:$PATH}" | 		export PATH="$TEST_BIN${PATH:+:$PATH}" | ||||||
| 		unset TEST_BIN | 		unset TEST_BIN | ||||||
|  | 	fi | ||||||
|  | else | ||||||
|  | 	# The build/install process ensures Python is available | ||||||
|  | 	test_set_prereq PYTHON | ||||||
| fi | fi | ||||||
|  |  | ||||||
| GIT_AUTHOR_EMAIL=author@example.com | GIT_AUTHOR_EMAIL=author@example.com | ||||||
| @@ -57,6 +64,15 @@ GIT_COMMITTER_EMAIL=committer@example.com | |||||||
| GIT_COMMITTER_NAME='C O Mitter' | GIT_COMMITTER_NAME='C O Mitter' | ||||||
| export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME | export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME | ||||||
| export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME | export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME | ||||||
|  |  | ||||||
| # maintain backwards compatible default | # maintain backwards compatible default | ||||||
| # (as used in remote helper) | # (as used in remote helper) | ||||||
| git config --global init.defaultBranch master | git config --global init.defaultBranch master | ||||||
|  | git config --global protocol.file.allow always | ||||||
|  |  | ||||||
|  | unset XDG_CONFIG_HOME | ||||||
|  |  | ||||||
|  | if [[ $(uname -s) = MSYS* ]]; then | ||||||
|  | 	test_set_prereq WIN | ||||||
|  | 	export TEST_CMP='diff --strip-trailing-cr -u' | ||||||
|  | fi | ||||||
|   | |||||||
| @@ -1,22 +1,16 @@ | |||||||
| #!/usr/bin/env ruby | #!/usr/bin/env ruby | ||||||
|  |  | ||||||
| # | # | ||||||
| # Copyright (c) 2019 Felipe Contreras | # Copyright (c) 2019-2023 Felipe Contreras | ||||||
| # | # | ||||||
| # This script runs the tests for all versions of the components: | # This script runs the tests for all versions of hg. | ||||||
| #   hg, hggit and dulwich |  | ||||||
| # | # | ||||||
| # You can run it without arguments, in which case it reads the file | # You can run it without arguments, in which case it runs the tests for all | ||||||
| # 'versions.txt' and executes all those checks. | # versions in `versions.txt`. | ||||||
| # | # | ||||||
| # Or you can pass the versions to check manually, like: | # Or you can specify a single version manually: | ||||||
| # | # | ||||||
| #   ./check-versions hg:4.7 hggit:0.8.12 dulwich:0.19.7 | #   ./check-versions 6.3 | ||||||
| # |  | ||||||
| # Or you can pass just the hg version, the other versions are fetched from |  | ||||||
| # 'versions.txt': |  | ||||||
| # |  | ||||||
| #   ./check-versions hg:5.0 |  | ||||||
| # | # | ||||||
|  |  | ||||||
| require 'fileutils' | require 'fileutils' | ||||||
| @@ -62,46 +56,26 @@ def check_version(a, b) | |||||||
|   (a <=> b) >= 0 |   (a <=> b) >= 0 | ||||||
| end | end | ||||||
|  |  | ||||||
| # Component {{{1 | # Hg {{{1 | ||||||
|  |  | ||||||
| class Component | class Hg | ||||||
|  |  | ||||||
|   attr_reader :id |   def initialize | ||||||
|  |     @url = 'https://www.mercurial-scm.org/repo/hg' | ||||||
|   def initialize(id, url, kind: nil, **args) |  | ||||||
|     @id = id |  | ||||||
|     @url = url |  | ||||||
|     @kind = kind || (url.start_with?('git') ? :git : :hg) |  | ||||||
|     @tool = @kind.to_s |  | ||||||
|     @checkout_fix = args[:checkout_fix] |  | ||||||
|     @version_format = args[:version_format] |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def dir |   def dir | ||||||
|     "#{$workdir}/#{@id}" |     "#{$workdir}/hg" | ||||||
|   end |  | ||||||
|  |  | ||||||
|   def get_version(version) |  | ||||||
|     return @kind == :hg ? 'tip' : '@' if version == '@' |  | ||||||
|     @version_format ? @version_format % version : version |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def clone |   def clone | ||||||
|     run_cmd [@tool, 'clone', '-q', @url, dir] |     run_cmd %w[hg clone -q] + [@url, dir] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def checkout(version) |   def checkout(version) | ||||||
|     Dir.chdir(dir) do |     Dir.chdir(dir) do | ||||||
|       case @kind |       run_cmd %w[hg update --clean -q] << version | ||||||
|       when :hg |       checkout_fix(version) | ||||||
|         cmd = %w[update --clean] |  | ||||||
|       when :git |  | ||||||
|         cmd = %w[reset --hard] |  | ||||||
|       else |  | ||||||
|         cmd = %w[checkout] |  | ||||||
|       end |  | ||||||
|       run_cmd [@tool] + cmd + ['-q', get_version(version)] |  | ||||||
|       @checkout_fix.call(version) if @checkout_fix |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -112,6 +86,18 @@ class Component | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   def checkout_fix(version) | ||||||
|  |     FileUtils.cp('hg', "#{$builddir}/bin/") | ||||||
|  |  | ||||||
|  |     return if check_version(version, '4.3') | ||||||
|  |  | ||||||
|  |     if run_cmd %W[hg import -q --no-commit #{__dir__}/hg_setup_hack_2.4.patch], fatal: false | ||||||
|  |       File.write('.hg_force_version', "%s\n" % version) | ||||||
|  |     else | ||||||
|  |       File.write('mercurial/__version__.py', "version = \"%s\"\n" % version) | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  |  | ||||||
| end | end | ||||||
|  |  | ||||||
| # Functions {{{1 | # Functions {{{1 | ||||||
| @@ -121,16 +107,14 @@ def setup | |||||||
|   FileUtils.mkdir_p(dirs.map { |e| "#{$builddir}/#{e}" }) |   FileUtils.mkdir_p(dirs.map { |e| "#{$builddir}/#{e}" }) | ||||||
|   FileUtils.mkdir_p($workdir) |   FileUtils.mkdir_p($workdir) | ||||||
|  |  | ||||||
|   $components.each do |id, component| |   return if File.exist?($hg.dir) | ||||||
|     next if File.exists?(component.dir) |  | ||||||
|  |  | ||||||
|   if $verbosity < HIGH |   if $verbosity < HIGH | ||||||
|       puts "Cloning #{component.id}" |     puts "Cloning hg" | ||||||
|   else |   else | ||||||
|       title "Cloning #{component.id}" |     title "Cloning hg" | ||||||
|     end |  | ||||||
|     component.clone |  | ||||||
|   end |   end | ||||||
|  |   $hg.clone | ||||||
| end | end | ||||||
|  |  | ||||||
| def test_env(paths: nil) | def test_env(paths: nil) | ||||||
| @@ -163,31 +147,14 @@ def run_tests(tests) | |||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| def versions_to_s(versions) | def check(version) | ||||||
|   versions.map { |k,v| "#{k}:#{v}" }.join(' ') |   section version | ||||||
| end |  | ||||||
|  |  | ||||||
| def versions_from_args(args) |   title "Checking out hg #{version}" | ||||||
|   args.map { |e| k, v = e.split(':'); [k.to_sym, v] }.to_h |   $hg.checkout(version) | ||||||
| end |  | ||||||
|  |  | ||||||
| def versions_from_s(str) |   title "Building hg" | ||||||
|   versions_from_args(str.split(' ')) |   $hg.build | ||||||
| end |  | ||||||
|  |  | ||||||
| def check(versions) |  | ||||||
|   section versions_to_s(versions) |  | ||||||
|  |  | ||||||
|   versions.each do |id, version| |  | ||||||
|     component = $components[id] |  | ||||||
|     next unless component |  | ||||||
|  |  | ||||||
|     title "Checking out #{component.id} #{version}" |  | ||||||
|     component.checkout(version) |  | ||||||
|  |  | ||||||
|     title "Building #{component.id}" |  | ||||||
|     component.build |  | ||||||
|   end |  | ||||||
|  |  | ||||||
|   paths = { |   paths = { | ||||||
|     PATH: "#{$builddir}/bin", |     PATH: "#{$builddir}/bin", | ||||||
| @@ -200,103 +167,31 @@ def check(versions) | |||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| # Add components {{{1 | $hg = Hg.new() | ||||||
|  |  | ||||||
| $components = {} |  | ||||||
|  |  | ||||||
| def add_component(id, url, **args) |  | ||||||
|   $components[id] = Component.new(id, url, **args) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| hg_checkout_fix = lambda do |version| |  | ||||||
|   FileUtils.cp('hg', "#{$builddir}/bin/") |  | ||||||
|  |  | ||||||
|   return if check_version(version, '4.3') |  | ||||||
|  |  | ||||||
|   if run_cmd %W[hg import -q --no-commit #{__dir__}/hg_setup_hack_2.4.patch], fatal: false |  | ||||||
|     File.write('.hg_force_version', "%s\n" % version) |  | ||||||
|   else |  | ||||||
|     File.write('mercurial/__version__.py', "version = \"%s\"\n" % version) |  | ||||||
|   end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| add_component(:hg, 'https://www.mercurial-scm.org/repo/hg', checkout_fix: hg_checkout_fix) |  | ||||||
|  |  | ||||||
| hggit_checkout_fix = lambda do |version| |  | ||||||
|   return unless check_version(version, '0.8.0') |  | ||||||
|  |  | ||||||
|   run_cmd %W[hg import -q --no-commit #{__dir__}/hggit_rename_fix_0.8.0.patch], fatal: false |  | ||||||
| end |  | ||||||
|  |  | ||||||
| add_component(:hggit, 'https://bitbucket.org/durin42/hg-git', checkout_fix: hggit_checkout_fix) |  | ||||||
|  |  | ||||||
| add_component(:dulwich, 'https://github.com/dulwich/dulwich.git', version_format: 'dulwich-%s', kind: :git) |  | ||||||
|  |  | ||||||
| def load_checks(file) |  | ||||||
|   file.each do |e| |  | ||||||
|     e.chomp! |  | ||||||
|     next if e.empty? or e.start_with?('#') |  | ||||||
|     content, comment = e.split(' # ') |  | ||||||
|     versions = versions_from_s(content) |  | ||||||
|     $checks << versions |  | ||||||
|   end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| def store_results(file) |  | ||||||
|   $results.each do |versions, result| |  | ||||||
|     content = versions_to_s(versions) |  | ||||||
|     comment = result ? 'OK' : 'FAIL' |  | ||||||
|     file.puts '%s # %s' % [content, comment] |  | ||||||
|   end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| # Main {{{1 | # Main {{{1 | ||||||
|  |  | ||||||
| setup | setup | ||||||
|  |  | ||||||
| $checks = [] | $checks = [] | ||||||
| $results = [] |  | ||||||
|  |  | ||||||
| $versions = versions_from_args(ARGV) | $version = ARGV.first | ||||||
|  | $checks = File.readlines(__dir__ + '/versions.txt', chomp: true) | ||||||
|  | $results = File.open(__dir__ + '/results.txt', 'w') | ||||||
|  |  | ||||||
| File.open("#{__dir__}/versions.txt") do |f| | if $version | ||||||
|   load_checks(f) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| if $versions.size == 1 and $versions.key?(:hg) |  | ||||||
|   # mode 1 |  | ||||||
|   $verbosity = LOW |  | ||||||
|  |  | ||||||
|   if ['@', nil].include?($versions[:hg]) |  | ||||||
|     versions = $checks.last |  | ||||||
|     versions[:hg] = $versions[:hg] if $versions[:hg] |  | ||||||
|   else |  | ||||||
|     versions = $checks.find { |e| e[:hg] == $versions[:hg] } |  | ||||||
|     exit 1 unless versions |  | ||||||
|   end |  | ||||||
|  |  | ||||||
|   exit check(versions) ? 0 : 1 |  | ||||||
| elsif not $versions.empty? |  | ||||||
|   # mode 2 |  | ||||||
|   $verbosity = HIGH |   $verbosity = HIGH | ||||||
|  |  | ||||||
|   exit check(versions) ? 0 : 1 |   exit check($version) ? 0 : 1 | ||||||
| else | else | ||||||
|   # mode 3 |  | ||||||
|   $verbosity = QUIET |   $verbosity = QUIET | ||||||
|  |  | ||||||
|   at_exit do |  | ||||||
|     File.open("#{__dir__}/results.txt", 'w') do |f| |  | ||||||
|       store_results(f) |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|  |  | ||||||
|   failures = 0 |   failures = 0 | ||||||
|  |  | ||||||
|   $checks.each do |versions| |   $checks.each do |version| | ||||||
|     result = check(versions) |     result = check(version) | ||||||
|     failures += 1 unless result |     failures += 1 unless result | ||||||
|     $results << [versions, result] |     $results.puts '%s # %s' % [version, result ? 'OK' : 'FAIL'] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   exit 1 unless failures == 0 |   exit 1 unless failures == 0 | ||||||
|   | |||||||
| @@ -1,22 +0,0 @@ | |||||||
| diff --git a/hggit/git_handler.py b/hggit/git_handler.py |  | ||||||
| --- a/hggit/git_handler.py |  | ||||||
| +++ b/hggit/git_handler.py |  | ||||||
| @@ -693,6 +693,8 @@ |  | ||||||
|      def import_git_commit(self, commit): |  | ||||||
|          self.ui.debug(_("importing: %s\n") % commit.id) |  | ||||||
|   |  | ||||||
| +        extra_in_message = self.ui.configbool('git', 'debugextrainmessage', False) |  | ||||||
| + |  | ||||||
|          detect_renames = False |  | ||||||
|          (strip_message, hg_renames, |  | ||||||
|           hg_branch, extra) = git2hg.extract_hg_metadata( |  | ||||||
| @@ -703,7 +705,8 @@ |  | ||||||
|              # renames detected from Git. This is because we export an extra |  | ||||||
|              # 'HG:rename-source' Git parameter when this isn't set, which will |  | ||||||
|              # break bidirectionality. |  | ||||||
| -            extra['hg-git-rename-source'] = 'git' |  | ||||||
| +            if not extra_in_message: |  | ||||||
| +                extra['hg-git-rename-source'] = 'git' |  | ||||||
|          else: |  | ||||||
|              renames = hg_renames |  | ||||||
|   |  | ||||||
| @@ -1,33 +1,46 @@ | |||||||
| # vi: ft=ruby | 2.4 | ||||||
|  | 2.5 | ||||||
| hg:2.4 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 2.6 | ||||||
| hg:2.5 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 2.7 | ||||||
| hg:2.6 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 2.8 | ||||||
| hg:2.7 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 2.9 | ||||||
| hg:2.8 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 3.0 | ||||||
| hg:2.9 hggit:0.4.0 dulwich:0.9.0 # 2013_02 | 3.1 | ||||||
|  | 3.2 | ||||||
| hg:3.0 hggit:0.7.0 dulwich:0.10.0 # 2014_11 | 3.3 | ||||||
| hg:3.1 hggit:0.7.0 dulwich:0.10.0 # 2014_11 | 3.4 | ||||||
| hg:3.2 hggit:0.7.0 dulwich:0.10.0 # 2014_11 | 3.5 | ||||||
|  | 3.6 | ||||||
| hg:3.3 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 3.7 | ||||||
| hg:3.4 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 3.8 | ||||||
| hg:3.5 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 3.9 | ||||||
| hg:3.6 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 4.0 | ||||||
| hg:3.7 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 4.1 | ||||||
| hg:3.8 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 4.2 | ||||||
| hg:3.9 hggit:0.8.4 dulwich:0.13.0 # 2016_01 | 4.3 | ||||||
|  | 4.4 | ||||||
| hg:4.0 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | 4.5 | ||||||
| hg:4.1 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | 4.6 | ||||||
| hg:4.2 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | 4.7 | ||||||
| hg:4.3 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | 4.8 | ||||||
| hg:4.4 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | 4.9 | ||||||
|  | 5.0 | ||||||
| hg:4.5 hggit:0.8.11 dulwich:0.18.0 # 2018_02 | 5.1 | ||||||
| hg:4.6 hggit:0.8.12 dulwich:0.19.7 # 2018_10 | 5.2 | ||||||
| hg:4.7 hggit:0.8.12 dulwich:0.19.7 # 2018_10 | 5.3 | ||||||
| hg:4.8 hggit:@ dulwich:0.19.11 | 5.4 | ||||||
| hg:4.9 hggit:@ dulwich:0.19.11 | 5.5 | ||||||
| hg:5.0 hggit:@ dulwich:0.19.11 | 5.6 | ||||||
|  | 5.7 | ||||||
|  | 5.8 | ||||||
|  | 5.9 | ||||||
|  | 6.0 | ||||||
|  | 6.1 | ||||||
|  | 6.2 | ||||||
|  | 6.3 | ||||||
|  | 6.4 | ||||||
|  | 6.5 | ||||||
|  | 6.6 | ||||||
|  | 6.7 | ||||||
|  | 6.8 | ||||||
|  | 6.9 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user