Workflow to synchronise Mercurial repositories via email with bundles -
i have 2 directories on 2 different computers - machine a (windows) , machine b (osx) - , want keep 2 directories via mercurial in sync. [*]
the restriction 2 machines not connected via lan/wan; the way move data between them via email. thought emailing mercurial bundles deltas trick.
my current workflow (using local tag lcb latest change bundle):
say work on machine a. @ end of day do:
hg commit -a -m "changes 123" hg bundle --base lcb bundle_123.hg hg tag --local -f lcb --rev tipfinally email bundle machine b.
then sitting @ machine b do
hg unbundle bundle_123.hg hg merge hg commit -a -m "remote changes 123" hg tag --local -f lcb --rev tipnow i'm working on machine b , @ end of day what's listed under 1., on machine b. , cycle continues...
however, i'm worry system not robust enough:
in-between changes: happens when after creating bundle (step 1) , before applying remotely (step 2) changes occurrs on remote machine b? had case overwrote changes new bundle without conflict warning or merge suggestion.
double-applying of bundle: happens when accident bundle applied twice? needed record applied bundles somehow local tags?
or there better workflow transfer mercurial deltas via email?
[*] answer superuser question figured mercurial might feasible way this.
- in-between changes: happens when after creating bundle (step 1) , before applying remotely (step 2) changes occurs on remote machine b? had case overwrote changes new bundle without conflict warning or merge suggestion.
if change made on machine b, change have been made in parallel changes bundled machine a. doesn't matter if changes made before or after create bundle (time-wise), matters changes on machine b don't have head machine ancestor.
in other words, world looks when 2 machines in sync:
a: ... [a] b: ... [a] you create new commits on machine a:
a: ... [a] --- [b] --- [c] b: ... [a] you bundle using [a] base, bundle [b] , [c]. let (perhaps yourself) makes commit on machine b:
a: ... [a] --- [b] --- [c] ( bundled ) b: ... [a] --- [x] so far nothing has been exchanged between 2 repositories, normal case of people working in parallel. norm in distributed version control system — people working in parallel creates need merge commits.
the need merge not evident in either repository @ point, both have linear histories. however, when unbundle on machine b, see divergence:
a: ... [a] --- [b] --- [c] ( bundled ) b: ... [a] --- [x] \ [b] --- [c] ( unbundled ) it helpful realize hg unbundle hg pull, except can done offline. is, data stored in bundle data hg pull have transferred if had had online connection between 2 repositories.
you proceed merging 2 heads [x] , [c] create [y] on machine b:
a: ... [a] --- [b] --- [c] b: ... [a] --- [x] --- [y] \ / [b] --- [c] on machine b last bundle created [a] base. however, know machine has commit [c], can specify additional base if like:
$ hg bundle --base --base c stuff-from-machine-b.hg that put [x] , [y] bundle:
bundle: (a) --- [x] --- [y] / (c) here use (a) , (c) denote required bases of bundle. can unbundle bundle if have both [a] , [c] in repository. if leave out second base (only use [a]), bundle [b] , [c]:
bundle: (a) --- [x] --- [y] \ / [b] --- [c] here included except [a] in bundle. bundling okay, see next.
- double-applying of bundle: happens when accident bundle applied twice? needed record applied bundles somehow local tags?
applying bundle twice running hg pull twice: nothing happens second time. when unbundling, mercurial looks in bundle , imports missing changesets. if unbundle twice, there nothing second time.
Comments
Post a Comment