hg pull -u -r rev bug?
timeless
timeless at gmail.com
Wed Oct 21 09:57:31 UTC 2009
On Wed, Oct 21, 2009 at 3:01 AM, Isaac Jurado <diptongo at gmail.com> wrote:
> Replying John Coomes:
>>
>> $ hg -R a pull -u -r 1 b
>
> You are using local revision numbers. That's not very wise when
> crossing repositories.
Wise or not, users are free to do whatever they like, and help text
and code should be consistent. If the code doesn't like the input, it
should complain, not misbehave.
-r --rev a specific revision up to which you would like to pull
here are the other two comments which are of interest:
def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
"""update working directory
Update the repository's working directory to the specified
revision, or the tip of the current branch if none is specified.
Use null as the revision to remove the working copy (like 'hg
clone -U').
When the working directory contains no uncommitted changes, it
will be replaced by the state of the requested revision from the
repository. When the requested revision is on a different branch,
the working directory will additionally be switched to that
branch.
It seems clear to me that the code is not doing what the comment
promises "replaced by the state of the requested revision from the
repository"
fwiw, I wish John had included the output of:
"hg log -R a" before "hg version", here's my rough output
changeset: 3:a5abdaf3ad57
tag: tip
parent: 0:c0732c29ff0d
summary: b.4
changeset: 2:ce98c64c104f
summary: a.3
changeset: 1:9909440da7f5
summary: a.2
changeset: 0:c0732c29ff0d
summary: a.1
for reference, "$ hg parents -R a"
changeset: 1:9909440da7f5
summary: a.2
So, the -r command did pull changeset 1 from b, but instead of
updating to it, it updated to the local 1.
I claim the help text is ideal and the implementation is buggy. But
I'm not crew.
Here are two changesets.
The first change doesn't cover contrib/zsh_completion (i'm not sure
how that file works)
Note that i'm using checkout instead of revs[0] ... i should probably
provide a testcase for that....
hg init a
echo 1 > a/1
hg -R a ci -Am 'a.1'
hg clone a b
echo 2 > a/2
hg -R a ci -Am 'a.2'
echo 3 > a/3
hg -R a ci -Am 'a.3'
echo 4 > b/4
hg -R b ci -Am 'b.4'
echo 5 > b/5
hg -R b ci -Am 'b.5'
hg up -R b 0
echo 6 > b/6
hg -R b ci -Am 'b.6'
hg up -R b 0
echo 7 > b/7
hg -R b ci -Am 'b.7'
hg -R a log
hg -R b log
hg -R a pull -u -r 2 -r 4 -r 3 b
hg -R a log
hg -R a parents
hg version
# HG changeset patch
# User timeless at mozdev.org
# Date 1256115794 -10800
# Node ID bf5a56657a842a80916570cef838c05a53ac45a3
# Parent 585d2ffe969bc5b8882d19e92130184edd27071f
Highlighting that rev is based on the remote repository
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3475,7 +3475,7 @@ table = {
('n', 'newest-first', None, _('show newest record first')),
('', 'bundle', '', _('file to store the bundles into')),
('r', 'rev', [],
- _('a specific revision up to which you would like to pull')),
+ _('a specific remote revision up to which you would like to pull')),
] + logopts + remoteopts,
_('[-p] [-n] [-M] [-f] [-r REV]...'
' [--bundle FILENAME] [SOURCE]')),
@@ -3543,7 +3543,7 @@ table = {
('f', 'force', None,
_('run even when remote repository is unrelated')),
('r', 'rev', [],
- _('a specific revision up to which you would like to pull')),
+ _('a specific remote revision up to which you would like to pull')),
] + remoteopts,
_('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
"^push":
# HG changeset patch
# User timeless at mozdev.org
# Date 1256118088 -10800
# Node ID c4cd5a22589496fe20ca9a2ef34db3ad8d37988c
# Parent bf5a56657a842a80916570cef838c05a53ac45a3
Use rev consistently from the remote repository when updating as part of a pull
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2298,6 +2298,8 @@ def pull(ui, repo, source="default", **o
raise util.Abort(err)
modheads = repo.pull(other, heads=revs, force=opts.get('force'))
+ if checkout:
+ checkout = str(repo.changelog.rev(other.lookup(checkout)))
return postincoming(ui, repo, modheads, opts.get('update'), checkout)
def push(ui, repo, dest=None, **opts):
More information about the Mercurial-devel
mailing list