3

Running hg pull implicitly retrieves everything on the default remote repo, while hg pull -b Branch-0 explicitly pulls changes only from branch Branch-0 from default.

Is there a way to configure/script mercurial to implicitly pull only say Branch-0 from remote if a branch is not specified?

It would be great if the default branch could be specific to a remote path, but I don't find that mandatory.

i.e.

$ hg pull remote
# only commits from Branch-0 were pulled
clausavram
  • 546
  • 8
  • 14
  • 1
    Nope, I don't think there's a way to do this. There's a feature to set a revset that specifies the revisions to *push* by default (see `hg help config.paths`, in particular the discussion about `pushrev`), but not *pull*. Perhaps file a feature request? – ngoldbaum Feb 22 '18 at 21:20
  • It's public history, why *wouldn't* you want it? – Mark Tolonen Feb 24 '18 at 06:56
  • 1
    Because in this case, most branches in the remote repo are the in-progress work of other people. With my local repo, I'd like to quickly pull only the things changed on the main branch and not have the local history continuously polluted. – clausavram Feb 25 '18 at 21:28

1 Answers1

4

You can work with alias in your .hgrc which allows to define new commands. You can use it also to re-define a built-in command like pull - yet that is explicitly warned against in the help files, so use the last line with great care or not at all:

[alias]
pullmybranch = pull -b MYBRANCH
pull = pull -b MYBRANCH
planetmaker
  • 5,884
  • 3
  • 28
  • 37