mirror of
				https://github.com/mnauw/git-remote-hg.git
				synced 2025-10-31 08:35:48 +01:00 
			
		
		
		
	Merge tag 'v0.5' into felipec
These changes can be merged with limited to no conflict resolution.
This commit is contained in:
		
							
								
								
									
										26
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| on: | ||||
|   push: | ||||
|     branches: [ master ] | ||||
|  | ||||
| jobs: | ||||
|   test: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       matrix: | ||||
|         hg: [ '5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7' ] | ||||
|     env: | ||||
|       HG_VERSION: ${{ matrix.hg }} | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/setup-python@v4 | ||||
|         with: | ||||
|           python-version: '2.7' | ||||
|       - name: Install python-dev | ||||
|         run: sudo apt-get install -y python2.7-dev | ||||
|       - name: Cache check-versions script | ||||
|         id: cache-check-versions | ||||
|         uses: actions/cache@v3 | ||||
|         with: | ||||
|           path: ~/.cache/git-remote-hg | ||||
|           key: check-versions | ||||
|       - run: ./tools/check-versions hg:$HG_VERSION | ||||
							
								
								
									
										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 | ||||
| @@ -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 | ||||
| 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" | ||||
| -------------------------------------- | ||||
|  | ||||
| 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 | ||||
| -------------------------------------- | ||||
|  | ||||
| @@ -49,7 +49,8 @@ If you want to see Mercurial revisions as Git commit notes: | ||||
| % 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 | ||||
| @@ -57,13 +58,14 @@ If you are not interested in Mercurial permanent and global branches (aka. commi | ||||
|  | ||||
| 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 | ||||
| -------------------------------------- | ||||
|  | ||||
| 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 | ||||
| @@ -71,15 +73,17 @@ If you want 'git-remote-hg' to be compatible with 'hg-git', and generate exactly | ||||
|  | ||||
| == 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. | ||||
|  | ||||
| The oldest version of mercurial supported is 1.9. For the most part 1.8 works, | ||||
| but you might experience some issues. | ||||
| The newest supported version of Mercurial is 6.1 but only through Python 2. The | ||||
| oldest one is 2.4. | ||||
|  | ||||
| Support for Python 3 is ready, but will be released in the next version soon. | ||||
|  | ||||
| === 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 | ||||
| @@ -89,7 +93,7 @@ To push a branch, you need to use the "branches/" prefix: | ||||
|  | ||||
| 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 === | ||||
|  | ||||
| @@ -99,7 +103,7 @@ The simplest way is to specify the user and password in the URL: | ||||
| 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] | ||||
| @@ -109,11 +113,7 @@ bb.password = password | ||||
| -------------------------------------- | ||||
|  | ||||
| Finally, you can also use the | ||||
| https://pypi.python.org/pypi/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. | ||||
| https://pypi.org/project/mercurial_keyring[keyring extension]. | ||||
|  | ||||
| === Submodules === | ||||
|  | ||||
| @@ -141,10 +141,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 | ||||
| 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. | ||||
|  | ||||
| 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 | ||||
| occur (https://github.com/felipec/git/issues/65[Bug #65]). | ||||
|  | ||||
| @@ -170,16 +170,27 @@ below for more details. | ||||
|  | ||||
| == Other projects == | ||||
|  | ||||
| There are other 'git-remote-hg' projects out there, do not confuse this one, | ||||
| this is the one distributed officially by the Git project | ||||
| (_though actually no longer so nowadays_): | ||||
| There are other `git-remote-hg` projects out there, but this is the original, | ||||
| which was distributed officially in the Git project. | ||||
|  | ||||
| * https://github.com/msysgit/msysgit/wiki/Guide-to-git-remote-hg[msysgit's git-remote-hg] | ||||
| * https://github.com/rfk/git-remote-hg[rfk's git-remote-hg] | ||||
| Over the years many similar tools have died out, the only actively maintained | ||||
| 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 | ||||
| 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]] | ||||
| == Limitations (or not) == | ||||
|  | ||||
|   | ||||
| @@ -159,6 +159,9 @@ def die(msg): | ||||
|     compat.stderr.write(b'ERROR: %s\n' % compat.to_b(msg, 'utf-8')) | ||||
|     sys.exit(1) | ||||
|  | ||||
| def debug(*args): | ||||
|     compat.stderr.write(b'DEBUG: %s\n' % compat.to_b(repr(args))) | ||||
|  | ||||
| def warn(msg): | ||||
|     compat.stderr.write(b'WARNING: %s\n' % compat.to_b(msg, 'utf-8')) | ||||
|     compat.stderr.flush() | ||||
|   | ||||
| @@ -209,6 +209,10 @@ def add_component(id, url, **args) | ||||
| end | ||||
|  | ||||
| hg_checkout_fix = lambda do |version| | ||||
|   if check_version(version, '5.7') | ||||
|     run_cmd %W[hg import -q --no-commit #{__dir__}/hg_revert_5.7.patch] | ||||
|   end | ||||
|  | ||||
|   FileUtils.cp('hg', "#{$builddir}/bin/") | ||||
|  | ||||
|   return if check_version(version, '4.3') | ||||
| @@ -225,10 +229,14 @@ add_component(:hg, 'https://www.mercurial-scm.org/repo/hg', checkout_fix: hg_che | ||||
| 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 | ||||
|   if check_version(version, '0.9.0') | ||||
|     run_cmd %W[hg import -q --no-commit #{__dir__}/hggit_rename_fix_0.9.0.patch], fatal: false | ||||
|   else | ||||
|     run_cmd %W[hg import -q --no-commit #{__dir__}/hggit_rename_fix_0.8.0.patch], fatal: false | ||||
|   end | ||||
| end | ||||
|  | ||||
| add_component(:hggit, 'https://bitbucket.org/durin42/hg-git', checkout_fix: hggit_checkout_fix) | ||||
| add_component(:hggit, 'https://foss.heptapod.net/mercurial/hg-git', checkout_fix: hggit_checkout_fix) | ||||
|  | ||||
| add_component(:dulwich, 'https://github.com/dulwich/dulwich.git', version_format: 'dulwich-%s', kind: :git) | ||||
|  | ||||
| @@ -280,7 +288,7 @@ elsif not $versions.empty? | ||||
|   # mode 2 | ||||
|   $verbosity = HIGH | ||||
|  | ||||
|   exit check(versions) ? 0 : 1 | ||||
|   exit check($versions) ? 0 : 1 | ||||
| else | ||||
|   # mode 3 | ||||
|   $verbosity = QUIET | ||||
|   | ||||
							
								
								
									
										24
									
								
								tools/hg_revert_5.7.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								tools/hg_revert_5.7.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| diff --git a/hg b/hg | ||||
| index 4ec2b6140b..a3e61ad39c 100755 | ||||
| --- a/hg | ||||
| +++ b/hg | ||||
| @@ -1,4 +1,4 @@ | ||||
| -#!/usr/bin/env python3 | ||||
| +#!/usr/bin/env python | ||||
|  # | ||||
|  # mercurial - scalable distributed SCM | ||||
|  # | ||||
| diff --git a/mercurial/hg.py b/mercurial/hg.py | ||||
| index 1a7a281e30..bf75f15ac1 100644 | ||||
| --- a/mercurial/hg.py | ||||
| +++ b/mercurial/hg.py | ||||
| @@ -1013,7 +1013,7 @@ def clone( | ||||
|                                  pass | ||||
|                  if uprev is None: | ||||
|                      try: | ||||
| -                        if destrepo._activebookmark: | ||||
| +                        if False: | ||||
|                              uprev = destrepo.lookup(destrepo._activebookmark) | ||||
|                              update = destrepo._activebookmark | ||||
|                          else: | ||||
|  | ||||
							
								
								
									
										22
									
								
								tools/hggit_rename_fix_0.9.0.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tools/hggit_rename_fix_0.9.0.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| diff --git a/hggit/git_handler.py b/hggit/git_handler.py | ||||
| --- a/hggit/git_handler.py | ||||
| +++ b/hggit/git_handler.py | ||||
| @@ -829,6 +829,8 @@ | ||||
|      def import_git_commit(self, commit): | ||||
|          self.ui.debug(_(b"importing: %s\n") % commit.id) | ||||
|   | ||||
| +        extra_in_message = self.ui.configbool(b'git', b'debugextrainmessage', False) | ||||
| + | ||||
|          detect_renames = False | ||||
|          (strip_message, hg_renames, | ||||
|           hg_branch, extra) = git2hg.extract_hg_metadata( | ||||
| @@ -839,7 +841,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[b'hg-git-rename-source'] = b'git' | ||||
| +            if not extra_in_message: | ||||
| +                extra[b'hg-git-rename-source'] = b'git' | ||||
|          else: | ||||
|              renames = hg_renames | ||||
|   | ||||
| @@ -26,8 +26,17 @@ hg:4.3 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | ||||
| hg:4.4 hggit:0.8.10 dulwich:0.18.0 # 2017_11 | ||||
|  | ||||
| hg:4.5 hggit:0.8.11 dulwich:0.18.0 # 2018_02 | ||||
| hg:4.6 hggit:0.8.12 dulwich:0.19.7 # 2018_10 | ||||
| hg:4.7 hggit:0.8.12 dulwich:0.19.7 # 2018_10 | ||||
| hg:4.8 hggit:@ dulwich:0.19.11 | ||||
| hg:4.9 hggit:@ dulwich:0.19.11 | ||||
| hg:5.0 hggit:@ dulwich:0.19.11 | ||||
| hg:4.6 hggit:0.8.13 dulwich:0.19.7 # 2018_10 | ||||
| hg:4.7 hggit:0.8.13 dulwich:0.19.7 # 2018_10 | ||||
| hg:4.8 hggit:0.8.13 dulwich:0.19.7 # 2018_10 | ||||
| hg:4.9 hggit:0.8.13 dulwich:0.19.7 # 2019_01 | ||||
| hg:5.0 hggit:0.8.13 dulwich:0.19.7 # 2019_04 | ||||
| hg:5.1 hggit:0.8.13 dulwich:0.19.7 # 2019_07 | ||||
| hg:5.2 hggit:0.8.13 dulwich:0.19.7 # 2019_11 | ||||
|  | ||||
| hg:5.3 hggit:0.9.0 dulwich:0.19.15 # 2020_01 | ||||
| hg:5.4 hggit:0.9.0 dulwich:0.19.15 # 2020_04 | ||||
| hg:5.5 hggit:0.9.0 dulwich:0.19.15 # 2020_08 | ||||
| hg:5.6 hggit:0.9.0 dulwich:0.19.15 # 2020_10 | ||||
|  | ||||
| hg:5.7 hggit:0.10.0 dulwich:0.19.16 # 2021_01 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user