DAGDA SEARCH | Back to results | Support

Source Control · pyparallel/pyparallel Wiki · GitHub

Source: https://github.com/pyparallel/pyparallel/wiki/Source-Control

Repository navigation

Source Control

Jump to bottom Edit New page Trent Nelson edited this page Sep 17, 2015 · 7 revisions

PyParallel development was initially located at https://hg.python.org/sandbox/trent. This sandbox was a clone/fork of the main hg.python.org CPython repository. The sandbox repo was mirrored here: https://bitbucket.org/python_mirrors/sandbox-trent. I subsequently forked that repo to https://bitbucket.org/tpn/pyparallel, which is where development took place up until August 2015.

In August 2015, the repository was migrated to https://github.com/pyparallel/pyparallel. This was done as follows:

1. Clone https://github.com/fingolfin/git-remote-hg into ~/src/git-remote-hg, add ~/src/git-remote-hg to PATH.

The fingolfin fork was necessary as there's a bug in the upstream felipec repo: https://github.com/felipec/git-remote-hg/issues/27.

2. Git clone https://bitbucket.org/tpn/pyparallel as follows:

% which git-remote-hg
~/src/git-remote-hg/git-remote-hg
% cd ~/src
% git clone "hg:https://bitbucket.org/tpn/pyparallel" px-bb-gh

This process took a few hours. Once completed, the px-bb-gh repo had all branches and tags from the Mecurial repo. I ran git gc --aggressive at this point too.

3. Create empty https://github.com/pyparallel/pyparallel repo and push px-bb-gh to it.

This took a bit of fiddling with .git/config and remotes and checking out the right branches and whatnot. The current .git/config for the repo looks like this:

% cat .git/config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
#[remote "origin"]
#	url = hg::https://bitbucket.org/tpn/pyparallel
#	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "bitbucket"]
	url = hg::https://bitbucket.org/tpn/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "github"]
	url = gh:pyparallel/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
	url = gh:pyparallel/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
#[branch "3.3-px"]
#	remote = github
#	merge = refs/heads/3.3-px
[branch "branches/3.3-px"]
	remote = origin
	merge = refs/heads/branches/3.3-px

Note: gh: is a host alias in my ~/.ssh/config file:

Host gh
    User git 
    IdentityFile ~/.ssh/id_rsa_github
    HostName github.com

Reviewing my zsh history (I should have taken better notes), it looks like the following was done in order to push master and 3.3-px.

% git push -u origin master
% git checkout -t origin/branches/3.3-px
% git push -u origin 3.3-px
% git push --set-upstream origin branches/3.3-px
% git push --tags

4. Mecurial/Git Synchronization

I keep ~/src/pyparallel as a hg clone of https://bitbucket.org/tpn/pyparallel. Its .hg/hgrc looks like this:

% cat .hg/hgrc
[paths]
default = https://bitbucket.org/tpn/pyparallel
upstream = https://hg.python.org/cpython

This allows me to keep the repository in sync with upstream CPython, which I achieve as follows:

% cd ~/src/pyparallel
% hg pull upstream
pulling from https://hg.python.org/cpython
searching for changes
adding changesets
adding manifests
adding file changes                                                                                                                              
added 3273 changesets with 7526 changes to 1622 files                                                                                            
(run 'hg update' to get a working copy)
% hg push default
pushing to https://bitbucket.org/tpn/pyparallel
searching for changes
abort: push creates new remote branches: 3.5!
(use 'hg push --new-branch' to create new remote branches)
% hg push default --new-branch
pushing to https://bitbucket.org/tpn/pyparallel
searching for changes
http authorization required for https://bitbucket.org/tpn/pyparallel                                                                             
realm: Bitbucket.org HTTP
user: tpn
password: 
remote: adding changesets                                                                                                                        
remote: adding manifests                                                                                                                         
remote: adding file changes                                                                                                                      
remote: added 3273 changesets with 7526 changes to 1622 files

I can then bring those changes in via the px-bb-gh git repo. (I'm not sure why it appears to re-sync all the branches -- anyone else?)

% cd ~/src/px-bb-gh
% git fetch bitbucket
searching for changes
adding changesets
adding manifests
adding file changes                                                                                                                              
added 3273 changesets with 7526 changes to 1622 files                                                                                            
progress revision 99 'px-pyclear-hackery' (100/58457)
...
progress revision 80699 'px-pyclear-hackery' (80700/58457)
progress revision 80799 'px-pyclear-hackery' (80800/58457)
progress revision 80899 'px-pyclear-hackery' (80900/58457)
progress revision 36999 '3.3-px-pygotham-2014-sprint' (37000/78475)
progress revision 37099 '3.3-px-pygotham-2014-sprint' (37100/78475)
progress revision 37199 '3.3-px-pygotham-2014-sprint' (37200/78475)
progress revision 37299 '3.3-px-pygotham-2014-sprint' (37300/78475)
...
progress revision 83599 '3.3-px-pygotham-2014-sprint' (83600/78475)
progress revision 83699 '3.3-px-pygotham-2014-sprint' (83700/78475)
progress revision 83799 '3.3-px-pygotham-2014-sprint' (83800/78475)
progress revision 83899 '3.3-px-pygotham-2014-sprint' (83900/78475)
progress revision 83999 '3.3-px-pygotham-2014-sprint' (84000/78475)
WARNING: Branch 'default' has more than one head, consider merging
progress revision 84099 'default' (84100/90419)
progress revision 84199 'default' (84200/90419)
progress revision 84299 'default' (84300/90419)
progress revision 84399 'default' (84400/90419)
...
progress revision 97399 'default' (97400/90419)
progress revision 97499 'default' (97500/90419)
progress revision 97699 'default' (97700/90419)
progress revision 97799 'default' (97800/90419)
progress revision 94299 '3.3-px' (94300/78838)
progress revision 94399 '3.3-px' (94400/78838)
progress revision 94499 '3.3-px' (94500/78838)
progress revision 84899 '2.7' (84900/78977)
progress revision 85299 '2.7' (85300/78977)
progress revision 85699 '2.7' (85700/78977)
progress revision 85899 '2.7' (85900/78977)
progress revision 86399 '2.7' (86400/78977)
...
progress revision 93799 '2.7' (93800/78977)
progress revision 93899 '2.7' (93900/78977)
progress revision 94099 '2.7' (94100/78977)
progress revision 96199 '2.7' (96200/78977)
progress revision 97299 '2.7' (97300/78977)
progress revision 97599 '2.7' (97600/78977)
From hg::https://bitbucket.org/tpn/pyparallel
   10d26e3..fade4de  branches/default -> origin/branches/default
   b3a8761..001e268  branches/3.4 -> origin/branches/3.4
 * [new branch]      branches/3.5 -> origin/branches/3.5
   fdce6aa..131a5ac  branches/3.2 -> origin/branches/3.2
   01dd059..f85ef9d  branches/2.7 -> origin/branches/2.7
   0ebdb0f..c949c34  branches/3.3 -> origin/branches/3.3
   10d26e3..fade4de  master     -> origin/master
 * [new tag]         v2.7.10    -> v2.7.10
 * [new tag]         v2.7.10rc1 -> v2.7.10rc1
 * [new tag]         v3.4.3     -> v3.4.3
 * [new tag]         v3.4.3rc1  -> v3.4.3rc1
 * [new tag]         v3.5.0a1   -> v3.5.0a1
 * [new tag]         v3.5.0a2   -> v3.5.0a2
 * [new tag]         v3.5.0a3   -> v3.5.0a3
 * [new tag]         v3.5.0a4   -> v3.5.0a4
 * [new tag]         v3.5.0b1   -> v3.5.0b1
 * [new tag]         v3.5.0b2   -> v3.5.0b2
 * [new tag]         v3.5.0b3   -> v3.5.0b3
 * [new tag]         v3.5.0b4   -> v3.5.0b4

Update (Sep 6th 2015): I just re-ran hg pull upstream, hg push default and git fetch bitbucket, and it didn't pull down all new revisions again:

% git fetch bitbucket
searching for changes
adding changesets
adding manifests
adding file changes
added 467 changesets with 692 changes to 210 files
WARNING: Branch 'default' has more than one head, consider merging
progress revision 97954 'default' (100/425)
progress revision 98054 'default' (200/425)
progress revision 98154 'default' (300/425)
progress revision 98254 'default' (400/425)
progress revision 97941 '2.7' (100/43)
progress revision 98141 '2.7' (300/43)
From hg::https://bitbucket.org/tpn/pyparallel
   fade4de..4676027  branches/default -> origin/branches/default
 + da138c3...e4b84c3 branches/3.3-px -> origin/branches/3.3-px  (forced update)
   001e268..a2538be  branches/3.4 -> origin/branches/3.4
   66e3dda..f391815  branches/3.5 -> origin/branches/3.5
   f85ef9d..168b2f9  branches/2.7 -> origin/branches/2.7
   10d26e3..4676027  master     -> origin/master
 * [new tag]         v3.5.0rc1  -> v3.5.0rc1
 * [new tag]         v3.5.0rc2  -> v3.5.0rc2

Pushing the CPython changes from Mercurial back to Github:

% cd ~/src/px-bb-gh
% git pull
<merge change>
% git push 
Counting objects: 1, done.
Writing objects: 100% (1/1), 246 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To gh:pyparallel/pyparallel
   838755d..c41a054  branches/3.3-px -> branches/3.3-px
% git push --tags
Counting objects: 19122, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6696/6696), done.
Writing objects: 100% (19122/19122), 119.49 MiB | 30.66 MiB/s, done.
Total 19122 (delta 14633), reused 16841 (delta 12363)
To gh:pyparallel/pyparallel
 * [new tag]         v2.7.10 -> v2.7.10
 * [new tag]         v2.7.10rc1 -> v2.7.10rc1
 * [new tag]         v3.4.3 -> v3.4.3
 * [new tag]         v3.4.3rc1 -> v3.4.3rc1
 * [new tag]         v3.5.0a1 -> v3.5.0a1
 * [new tag]         v3.5.0a2 -> v3.5.0a2
 * [new tag]         v3.5.0a3 -> v3.5.0a3
 * [new tag]         v3.5.0a4 -> v3.5.0a4
 * [new tag]         v3.5.0b1 -> v3.5.0b1
 * [new tag]         v3.5.0b2 -> v3.5.0b2
 * [new tag]         v3.5.0b3 -> v3.5.0b3
 * [new tag]         v3.5.0b4 -> v3.5.0b4

To push new CPython branches from Mecurial to Github:

% cd ~/src/px-bb-gh
% git checkout -b branches/3.5
% git push --set-upstream origin branches/3.5
Counting objects: 522, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (218/218), done.
Writing objects: 100% (522/522), 1.62 MiB | 0 bytes/s, done.
Total 522 (delta 416), reused 410 (delta 304)
To gh:pyparallel/pyparallel
 * [new branch]      branches/3.5 -> branches/3.5
Branch branches/3.5 set up to track remote branch branches/3.5 from origin.

TL;DR steps for keeping in sync

Sep 6th 2015

% cd ~/src/pyparallel
% cat .hg/hgrc
[paths]
default = https://bitbucket.org/tpn/pyparallel
upstream = https://hg.python.org/cpython
% hg pull upstream
pulling from https://hg.python.org/cpython
searching for changes
adding changesets
adding manifests
adding file changes
added 9 changesets with 22 changes to 14 files
(run 'hg update' to get a working copy)
% hg push default
pushing to https://bitbucket.org/tpn/pyparallel
searching for changes
remote: adding changesets                                                                                            
remote: adding manifests                                                                                             
remote: adding file changes                                                                                          
remote: added 9 changesets with 22 changes to 14 files                  
% cd ~/src/px-bb-gh
% cat .git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
#[remote "origin"]
#	url = hg::https://bitbucket.org/tpn/pyparallel
#	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "bitbucket"]
	url = hg::https://bitbucket.org/tpn/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "github"]
	url = gh:pyparallel/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
	url = gh:pyparallel/pyparallel
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
#[branch "3.3-px"]
#	remote = github
#	merge = refs/heads/3.3-px
[branch "branches/3.3-px"]
	remote = origin
	merge = refs/heads/branches/3.3-px
[branch "branches/3.5"]
	remote = origin
	merge = refs/heads/branches/3.5
% git branch
  branches/3.3-px
* branches/3.5
  master
% git pull bitbucket
searching for changes
adding changesets
adding manifests
adding file changes
added 9 changesets with 22 changes to 14 files
WARNING: Branch 'default' has more than one head, consider merging
From hg::https://bitbucket.org/tpn/pyparallel
   4676027..e2cfbbd  branches/default -> origin/branches/default
   a2538be..71dec51  branches/3.4 -> origin/branches/3.4
 + bc58baa...b9781b4 branches/3.5 -> origin/branches/3.5  (forced update)
   168b2f9..07a50ce  branches/2.7 -> origin/branches/2.7
   4676027..e2cfbbd  master     -> origin/master
You asked to pull from the remote 'bitbucket', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
% git pull bitbucket branches/3.5
searching for changes
no changes found
From hg::https://bitbucket.org/tpn/pyparallel
 * branch            branches/3.5 -> FETCH_HEAD

  1 Merge branch 'branches/3.5' of hg::https://bitbucket.org/tpn/pyparallel into branches/3.5
  2 
  3 # Please enter a commit message to explain why this merge is necessary,
  4 # especially if it merges an updated upstream into a topic branch.
  5 #
  6 # Lines starting with '#' will be ignored, and an empty message aborts
  7 # the commit.
Merge made by the 'recursive' strategy.
 Lib/html/parser.py          |  10 ++++-
 Lib/test/test_htmlparser.py |  15 +++++--
 Lib/test/test_shutil.py     | 172 +++++++++++++++++++++++++++++++++++++++------------------------------------------
 Misc/NEWS                   |   6 ++-
 4 files changed, 109 insertions(+), 94 deletions(-)
% git push
Counting objects: 29, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (29/29), 9.59 KiB | 0 bytes/s, done.
Total 29 (delta 24), reused 12 (delta 8)
To gh:pyparallel/pyparallel
   bc58baa..eeef39d  branches/3.5 -> branches/3.5

So for next time, exact commands to try:

cd ~/src/pyparallel
hg pull upstream
hg push default
cd ~/src/px-bb-gh
git branch | grep '^* branches/3.5' > /dev/null || git checkout branches/3.5
git pull bitbucket branches/3.5
git push

Update 17th September 2015

The above worked, but also had to do git pull bitbucket to pick up the v3.5.0 tags:

% git pull bitbucket                                                          
searching for changes
no changes found
WARNING: Branch 'default' has more than one head, consider merging
progress revision 98633 'default' (300/286)
From hg::ssh://hg@bitbucket.org/tpn/pyparallel
   e2cfbbd..10e7b3b  branches/default -> origin/branches/default
 + 87ae1b0...e4b84c3 branches/3.3-px -> origin/branches/3.3-px  (forced update)
   71dec51..d4217b6  branches/3.4 -> origin/branches/3.4
 + 95aaa73...1abc598 branches/3.5 -> origin/branches/3.5  (forced update)
   07a50ce..c998a79  branches/2.7 -> origin/branches/2.7
   c949c34..e0b0cc2  branches/3.3 -> origin/branches/3.3
   10d26e3..10e7b3b  master     -> origin/master
 * [new tag]         v3.5.0     -> v3.5.0
 * [new tag]         v3.5.0rc3  -> v3.5.0rc3
 * [new tag]         v3.5.0rc4  -> v3.5.0rc4
You asked to pull from the remote 'bitbucket', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
% git push 
Everything up-to-date
% git push --tags
Total 0 (delta 0), reused 0 (delta 0)
To gh:pyparallel/pyparallel
 * [new tag]         v3.5.0 -> v3.5.0
 * [new tag]         v3.5.0rc3 -> v3.5.0rc3
 * [new tag]         v3.5.0rc4 -> v3.5.0rc4
Add a custom footer Add a custom sidebar

Clone this wiki locally