1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 22:56:15 +01:00
This commit is contained in:
Jürgen Weigert 2009-09-07 18:49:01 +00:00
parent eadf7999cb
commit 7ea7ecee3d
3 changed files with 36 additions and 12 deletions

4
NEWS
View File

@ -16,6 +16,10 @@
- support modification flages on creation of submit request
(for auto update or clean up packages or to avoid it, when submit request got accepted)
- show request ids from package source logs
#
- fixed osc diff -c N, it failed with int and string concatenation
- made osc diff and rdiff more similar: added -p, -c to rdiff, removed -u from rdiff.
made -u default for both, renamed --pretty to --plain as it is the opposite of -u
0.121.1
- fixed creation of new ~/.oscrc files

View File

@ -1406,8 +1406,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
'the revision (rev1) on the server. '
'If rev1 and rev2 are specified it will compare rev1 against rev2 '
'(NOTE: changes in your working copy are ignored in this case)')
@cmdln.option('-p', '--pretty', action='store_true',
help='output the diff in the pretty diff format')
@cmdln.option('-p', '--plain', action='store_true',
help='output the diff in plain (not unified) diff format')
def do_diff(self, subcmd, opts, *args):
"""${cmd_name}: Generates a diff
@ -1435,6 +1435,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
return
except:
print >>sys.stderr, 'Revision \'%s\' not an integer' % opts.change
return
else:
rev1, rev2 = parseRevisionOption(opts.revision)
@ -1444,7 +1445,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
diff += ''.join(make_diff(pac, rev1))
else:
diff += server_diff(pac.apiurl, pac.prjname, pac.name, rev1,
pac.prjname, pac.name, rev2, not opts.pretty)
pac.prjname, pac.name, rev2, not opts.plain)
if len(diff) > 0:
print diff
@ -1455,8 +1456,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='package to compare against')
@cmdln.option('-r', '--revision', metavar='N[:M]',
help='revision id, where N = old revision and M = new revision')
@cmdln.option('-u', '--unified', action='store_true',
help='output the diff in the unified diff format')
@cmdln.option('-p', '--plain', action='store_true',
help='output the diff in plain (not unified) diff format')
@cmdln.option('-c', '--change', metavar='rev',
help='the change made by revision rev (like -r rev-1:rev).'
'If rev is negative this is like -r rev:rev-1.')
def do_rdiff(self, subcmd, opts, new_project, new_package):
"""${cmd_name}: Server-side "pretty" diff of two packages
@ -1472,14 +1476,30 @@ Please submit there instead, or use --nodevelproject to force direct submission.
${cmd_option_list}
"""
old_revision = None
new_revision = None
if opts.revision:
old_revision, new_revision = parseRevisionOption(opts.revision)
rev1 = None
rev2 = None
if opts.change:
try:
rev = int(opts.change)
if rev > 0:
rev1 = rev - 1
rev2 = rev
elif rev < 0:
rev1 = -rev
rev2 = -rev - 1
else:
return
except:
print >>sys.stderr, 'Revision \'%s\' not an integer' % opts.change
return
else:
if opts.revision:
rev1, rev2 = parseRevisionOption(opts.revision)
rdiff = server_diff(conf.config['apiurl'],
opts.oldprj, opts.oldpkg, old_revision,
new_project, new_package, new_revision, opts.unified)
opts.oldprj, opts.oldpkg, rev1,
new_project, new_package, rev2, not opts.plain)
print rdiff

View File

@ -2695,7 +2695,7 @@ def make_diff(wc, revision):
tempdir = '/tmp'
if sys.platform[:3] == 'win':
tempdir = os.getenv('TEMP')
tmpdir = tempfile.mkdtemp(revision, wc.name, dir = tempdir)
tmpdir = tempfile.mkdtemp(str(revision), wc.name, dir = tempdir)
os.chdir(tmpdir)
init_package_dir(wc.apiurl, wc.prjname, wc.name, tmpdir, revision)
cmp_pac = Package(tmpdir)