rietveld-codereview / rietveld

Code Review, hosted on Google App Engine
https://codereview.appspot.com
Apache License 2.0
556 stars 152 forks source link

REV arg is ignored for mercurial vcs on windows 7 #219

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a local topic branch
2. Implement some changes, making lots of local commits to topic branch
3. Merge back into "default" branch (it misbehaves whether you commit or not)
4. Attempt to run upload.py with --rev=[REV_BEFORE_MY_WORK_STARTED] or 
--rev=[REV_BEFORE:REV_AFTER] and watch it fail

What is the expected output? What do you see instead?

I expect it to diff the revs I give it and generate a CR.  Instead I see that:
1. (if I don't commit the merge locally) "No valid patches found in output from 
hg diff" - I added some test output to upload.py to verify that it's not 
passing the rev arg to mercurial, never parsing it for that matter.
2. (if I commit the merge locally first)

D:\src\Projects\nativeclient-vsx>upload.py --reviewers=ilewis@google.com,noelall
en@google.com,mmortensen@google.com --send_mail -s codereview.chromium.org 
--rev=174
The following files are not added to version control:
build\NativeClientVSX.5.1.ReSharper
Are you sure to continue?(y/N) y
Got error status from ['hg', 'cat', '-r', 'e4adf2482e4c\n179', 'M src\\NaClVsx.P
ackage\\NaClVsx.Package.csproj']:
hg cat [OPTION]... FILE...
... 

Note that the revision arg is broken.  It's not referencing a valid revision 
because the global rev id that is uses here corresponds to local revision 174 
on that particular box.  Also the \n looks rather suspicious.  Also, it doesn't 
matter what I supply as --rev= or -r.  It's ignored by the hg vcs class, even 
though it shouldn't be.

What version of the product are you using? On what operating system?

Latest downloadable upload.py, updated windows 7, python 2.6.2, TortoiseHG 
1.1.1 

*** If you are a Google employee please say so or mail me (Guido van
Rossum) directly. ***

I am a google employee

Please provide any additional information below.

Original issue reported on code.google.com by mli...@google.com on 27 Aug 2010 at 3:49

GoogleCodeExporter commented 9 years ago
Using the --rev option for mercurial works fine for me. But you're right, the 
"\n" looks suspicious. Could you post the output (the hg commands are of 
interest) when running with --noisy flag? Maybe there some special formatting 
rules in your .hgrc or builtin in TortoiseHG and upload.py has some troubles 
parsing the output of one of the commands.

Original comment by albrecht.andi on 27 Aug 2010 at 4:46

GoogleCodeExporter commented 9 years ago
--noisy is maybe a bit too much, --verbose prints out everything relevant :)

Original comment by albrecht.andi on 27 Aug 2010 at 5:10

GoogleCodeExporter commented 9 years ago
I figured out a workaround for my problem.  Args were not being forwarded by 
windows and I had to turn "python upload.py --args" instead of "upload.py 
--args".  The \n is still suspicious.  I'll make it happen again and post it 
because that looks like it should never happen with or without args.

Original comment by mli...@google.com on 27 Aug 2010 at 5:19

GoogleCodeExporter commented 9 years ago
D:\src\Projects\nativeclient-vsx>upload.py --reviewers=ilewis@google.com,noelall
en@google.com,mmortensen@google.com --send_mail -s codereview.chromium.org
The following files are not added to version control:
build\NativeClientVSX.5.1.ReSharper
Are you sure to continue?(y/N) y
Got error status from ['hg', 'cat', '-r', 'e4adf2482e4c\n179', 'M src\\NaClVsx.P
ackage\\NaClVsx.Package.csproj']:
hg cat [OPTION]... FILE...

output the current or given revision of files

    Print the specified files as they were at the given revision. If no
    revision is given, the parent of the working directory is used, or tip if
    no revision is checked out.

    Output may be to a file, in which case the name of the file is given
    using a format string. The formatting rules are the same as for the
    export command, with the following additions:

    "%s"  basename of file being printed
    "%d"  dirname of file being printed, or '.' if in repository root
    "%p"  root-relative path name of file being printed

    Returns 0 on success.

options:

 -o --output FORMAT        print output to file with formatted name
 -r --rev REV              print the given revision
    --decode               apply any matching decode filter
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns

global options:
 -R --repository REPO      repository root directory or name of overlay
                           bundle file
    --cwd DIR              change working directory
 -y --noninteractive       do not prompt, assume 'yes' for any required
                           answers
 -q --quiet                suppress output
 -v --verbose              enable additional output
    --config CONFIG [+]    set/override config option (use
                           'section.name=value')
    --debug                enable debugging output
    --debugger             start debugger
    --encoding ENCODE      set the charset encoding (default: cp1252)
    --encodingmode MODE    set the charset encoding mode (default: strict)
    --traceback            always print a traceback on exception
    --time                 time how long the command takes
    --profile              print command execution profile
    --version              output version information and exit
 -h --help                 display help and exit

[+] marked option can be specified multiple times

Original comment by mli...@google.com on 27 Aug 2010 at 5:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
here is output from upload.py being run as python.  The problem still occurs 
when a topic branch has been merged but not committed and upload.py is running 
without args.  I'm glancing at the code for upload.py and though I don't 
understand python very well, it looks to me like the code for diffing hg 
revisions ought to look more like the code for diffing git revision than it 
does at the moment:
D:\src\Projects\nativeclient-vsx>python c:\depot_tools\upload.py
RealMain: starting
RealMain: Arguments parsed
{'save_cookies': True, 'account_type': 'GOOGLE', 'verbose': 1, 'cc': None, 'revi
ewers': None, 'description_file': None, 'emulate_svn_auto_props': False, 'downlo
ad_base': False, 'private': False, 'base_url': None, 'revision': None, 'send_mai
l': False, 'host': None, 'vcs': None, 'issue': None, 'message': None, 'server':
'codereview.appspot.com', 'assume_yes': False, 'email': None, 'description': Non
e}
GuessVCSName: decided vcs is mercurial
GuessVCS: GuessVCSName finished
Constructor running
('MercurialVCS::__init__ Defaulted base rev to ', '47228efd56ab\n182')
RealMain: Got VCS
The following files are not added to version control:
build\NativeClientVSX.5.1.ReSharper
Are you sure to continue?(y/N) y
Mercurial::GenerateDiff: extra args are
['.']
('got data: ', 'diff --git a/new_file b/new_file\n--- /dev/null\n+++ b/new_file\
n@@ -0,0 +1,1 @@\n+"small change" \n')
Got error status from ['hg', 'cat', '-r', '47228efd56ab\n182', '? build\\NativeC
lientVSX.5.1.ReSharper']:
hg cat [OPTION]... FILE...

output the current or given revision of files

    Print the specified files as they were at the given revision. If no
    revision is given, the parent of the working directory is used, or tip if
    no revision is checked out.

    Output may be to a file, in which case the name of the file is given
    using a format string. The formatting rules are the same as for the
    export command, with the following additions:

    "%s"  basename of file being printed
    "%d"  dirname of file being printed, or '.' if in repository root
    "%p"  root-relative path name of file being printed

    Returns 0 on success.

options:

 -o --output FORMAT        print output to file with formatted name
 -r --rev REV              print the given revision
    --decode               apply any matching decode filter
 -I --include PATTERN [+]  include names matching the given patterns
 -X --exclude PATTERN [+]  exclude names matching the given patterns

global options:
 -R --repository REPO      repository root directory or name of overlay
                           bundle file
    --cwd DIR              change working directory
 -y --noninteractive       do not prompt, assume 'yes' for any required
                           answers
 -q --quiet                suppress output
 -v --verbose              enable additional output
    --config CONFIG [+]    set/override config option (use
                           'section.name=value')
    --debug                enable debugging output
    --debugger             start debugger
    --encoding ENCODE      set the charset encoding (default: cp1252)
    --encodingmode MODE    set the charset encoding mode (default: strict)
    --traceback            always print a traceback on exception
    --time                 time how long the command takes
    --profile              print command execution profile
    --version              output version information and exit
 -h --help                 display help and exit

[+] marked option can be specified multiple times

Original comment by mli...@google.com on 27 Aug 2010 at 5:29

GoogleCodeExporter commented 9 years ago

Original comment by albrecht.andi on 6 Apr 2012 at 7:19