3

I'm trying to understand how to push my mercurial patches to a remote repo (say, bitbucket.org), without having to apply them first (actually committing them). My motivation is to first have a remote backup to my work before it's final, and also to be able to share these patches with other people or work on them from a different machine.

My normal workflow is this:

$ hg qnew some-feature -m "work on some feature"

... work on some files

$ hg qref

--> bug or other feature request comes along

$ hg qpop some-feature
$ hg qnew new-feature -m "work on different feature"
... work on new stuff
$ hg qref

At the point, I'd like to push my unfinished, uncommitted patches to the repo. I've read about how Mercurial queues are in fact their own repos and can therefore be manipulated just like a normal hg repo, but I'm unclear as to the workflow with respect to what I'm trying to do. I've aliased mq command in my shell to hg -R $(hg root)/.hg/patches, but I'd appreciate some feedback on how people manage remote backup and sharing of uncomitted patches. thanks.

sa125
  • 28,121
  • 38
  • 111
  • 153

3 Answers3

2

On Bitbucket, you can create both repositories and patch queues. Bitbucket doesn't appear to have provided detailed official documentation for patch queues yet, but there is a blog post that describes how to use them.

To backup/share uncommitted patches, the basic workflow commands are:

hg init --mq # initialize .hg/patches as a versioned repository (hereafter referred to as the MQ repository)
# manually configure .hg/patches/.hg/hgrc to contain a [paths] section if desired
hg commit --mq # commit in the MQ repository
hg push --mq # push the MQ repository to default remote
hg pull --mq # pull the MQ repository from default remote
hg update --mq/hg merge --mq # same as normal for hg, but operating on the MQ repository

In older versions of Mercurial, the hg init --mq and hg commit --mq commands were provided as hg qinit and hg qcommit (which are now deprecated).

davidmc24
  • 2,232
  • 1
  • 19
  • 17
1
  • hg push --mq pushes changesets and patches in MQ
  • mqcollab - easy exchange of and collaboration on MQ patches
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
1

You can create a repository in your .hg/patches and push it as a separate repository. In later versions of mercurial you just do hg ci --mq and it will commit the latest version of your patch repository. Once it's commited, you can clone it to bitbucket.

Stephen Rasku
  • 2,554
  • 7
  • 29
  • 51