Hello community,
here is the log from the commit of package osc for openSUSE:Factory checked in at 2013-02-01 09:49:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/osc (Old)
and /work/SRC/openSUSE:Factory/.osc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "osc", Maintainer is "adrian@suse.com"
Changes:
--------
--- /work/SRC/openSUSE:Factory/osc/osc.changes 2012-12-05 14:01:20.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.osc.new/osc.changes 2013-02-01 09:49:26.000000000 +0100
@@ -1,0 +2,11 @@
+Thu Jan 31 15:45:58 UTC 2013 - adrian@suse.com
+
+- update to 0.138.0:
+ - add support to remove repositories recursively (mostly only usefull for admins)
+ - submitrequest: old not anymore used maintenance code got removed. It is possible now
+ to create one request to submit all changed packages of an project in
+ one request. Just run "osc sr" in the checked out project directory.
+ - disable keyring usage by default. print warning about misconfigured keyrings.
+ - prdiff: new command to diff entire projects
+
+-------------------------------------------------------------------
Old:
----
osc-0.137.0.tar.gz
New:
----
osc-0.138.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ osc.spec ++++++
--- /var/tmp/diff_new_pack.KGh0Hd/_old 2013-02-01 09:49:27.000000000 +0100
+++ /var/tmp/diff_new_pack.KGh0Hd/_new 2013-02-01 09:49:27.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package osc
#
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: osc
-Version: 0.137.0
+Version: 0.138.0
Release: 0
Summary: openSUSE Build Service Commander
License: GPL-2.0+
++++++ _service ++++++
--- /var/tmp/diff_new_pack.KGh0Hd/_old 2013-02-01 09:49:27.000000000 +0100
+++ /var/tmp/diff_new_pack.KGh0Hd/_new 2013-02-01 09:49:27.000000000 +0100
@@ -1,6 +1,6 @@
<services>
<service name="tar_scm" mode="disabled">
- <param name="version">0.137.0</param>
+ <param name="version">0.138.0</param>
<param name="url">git://github.com/openSUSE/osc.git</param>
<param name="scm">git</param>
</service>
++++++ osc-0.137.0.tar.gz -> osc-0.138.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/.travis.yml new/osc-0.138.0/.travis.yml
--- old/osc-0.137.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/.travis.yml 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,7 @@
+language: python
+python:
+ - "2.7"
+before_install:
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq diffstat
+script: cd tests; python suite.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/NEWS new/osc-0.138.0/NEWS
--- old/osc-0.137.0/NEWS 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/NEWS 2013-01-31 16:46:36.000000000 +0100
@@ -1,3 +1,11 @@
+0.138
+ - add support to remove repositories recursively (mostly only usefull for admins)
+ - submitrequest: old not anymore used maintenance code got removed. It is possible now
+ to create one request to submit all changed packages of an project in
+ one request. Just run "osc sr" in the checked out project directory.
+ - disable keyring usage by default. print warning about misconfigured keyrings.
+ - prdiff: new command to diff entire projects
+
0.137
- support single binary download via getbinaries command
- support to set the bugowner
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/osc/commandline.py new/osc-0.138.0/osc/commandline.py
--- old/osc-0.137.0/osc/commandline.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/osc/commandline.py 2013-01-31 16:46:36.000000000 +0100
@@ -548,6 +548,8 @@
help='edit metadata')
@cmdln.option('-c', '--create', action='store_true',
help='create attribute without values')
+ @cmdln.option('-R', '--remove-linking-repositories', action='store_true',
+ help='Try to remove also all repositories building against remove ones.')
@cmdln.option('-s', '--set', metavar='ATTRIBUTE_VALUES',
help='set attribute values')
@cmdln.option('--delete', action='store_true',
@@ -697,6 +699,7 @@
edit_meta(metatype='prj',
edit=True,
force=opts.force,
+ remove_linking_repositories=opts.remove_linking_repositories,
path_args=quote_plus(project),
apiurl=apiurl,
template_args=({
@@ -762,6 +765,7 @@
data=f,
edit=opts.edit,
force=opts.force,
+ remove_linking_repositories=opts.remove_linking_repositories,
apiurl=apiurl,
path_args=quote_plus(project))
elif cmd == 'pkg':
@@ -819,6 +823,8 @@
@cmdln.option('--nodevelproject', action='store_true',
help='do not follow a defined devel project ' \
'(primary project where a package is developed)')
+ @cmdln.option('--seperate-requests', action='store_true',
+ help='Create multiple request instead of a single one (when command is used for entire project)')
@cmdln.option('--cleanup', action='store_true',
help='remove package if submission gets accepted (default for home:<id>:branch projects)')
@cmdln.option('--no-cleanup', action='store_true',
@@ -866,6 +872,10 @@
elif opts.no_update:
src_update = "noupdate"
+ myreqs = []
+ if opts.supersede:
+ myreqs = [opts.supersede]
+
args = slash_split(args)
# remove this block later again
@@ -885,94 +895,74 @@
if len(args) > 4:
raise oscerr.WrongArgs('Too many arguments.')
- if len(args) > 0 and len(args) <= 2 and is_project_dir(os.getcwd()):
- sys.exit('osc submitrequest from project directory is only working without target specs and for source linked files\n')
+ if len(args) == 2 and is_project_dir(os.getcwd()):
+ sys.exit('You can not specify a target package when submitting an entire project\n')
apiurl = self.get_api_url()
- if len(args) == 0 and is_project_dir(os.getcwd()):
+ if len(args) < 2 and is_project_dir(os.getcwd()):
import cgi
- # submit requests for multiple packages are currently handled via multiple requests
- # They could be also one request with multiple actions, but that avoids to accepts parts of it.
project = store_read_project(os.curdir)
sr_ids = []
- pi = []
- pac = []
- targetprojects = []
+ # for single request
+ actionxml = ""
+ options_block=""
+ if src_update:
+ options_block="""<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
+
# loop via all packages for checking their state
for p in meta_get_packagelist(apiurl, project):
- if p.startswith("_patchinfo:") or p.startswith("patchinfo"):
- pi.append(p)
- else:
- # get _link info from server, that knows about the local state ...
- u = makeurl(apiurl, ['source', project, p])
- f = http_GET(u)
- root = ET.parse(f).getroot()
- linkinfo = root.find('linkinfo')
- if linkinfo == None:
- print "Package ", p, " is not a source link."
+ print "XXX", p
+ # get _link info from server, that knows about the local state ...
+ u = makeurl(apiurl, ['source', project, p])
+ f = http_GET(u)
+ root = ET.parse(f).getroot()
+ if len(args) == 1:
+ target_project = args[0]
+ linkinfo = root.find('linkinfo')
+ if linkinfo == None:
+ if len(args) < 1:
+ print "Package ", p, " is not a source link and no target specified."
sys.exit("This is currently not supported.")
+ else:
if linkinfo.get('error'):
print "Package ", p, " is a broken source link."
sys.exit("Please fix this first")
t = linkinfo.get('project')
if t:
+ if target_project == None:
+ target_project = t
if len(root.findall('entry')) > 1: # This is not really correct, but should work mostly
# Real fix is to ask the api if sources are modificated
# but there is no such call yet.
- targetprojects.append(t)
- pac.append(p)
print "Submitting package ", p
else:
- print " Skipping package ", p
+ print " Skipping not modified package ", p
+ next
else:
print "Skipping package ", p, " since it is a source link pointing inside the project."
- serviceinfo = root.find('serviceinfo')
- if serviceinfo != None:
- if serviceinfo.get('code') != "succeeded":
- print "Package ", p, " has a ", serviceinfo.get('code'), " source service"
- sys.exit("Please fix this first")
- if serviceinfo.get('error'):
- print "Package ", p, " contains a failed source service."
- sys.exit("Please fix this first")
-
- # was this project created by clone request ?
- u = makeurl(apiurl, ['source', project, '_attribute', 'OBS:RequestCloned'])
- f = http_GET(u)
- root = ET.parse(f).getroot()
- value = root.findtext('attribute/value')
- myreqs = {}
- if value:
- myreqs = [ value ]
-
- if not opts.yes:
- if pi:
- print "Submitting patchinfo ", ', '.join(pi), " to ", ', '.join(targetprojects)
- repl = raw_input('\nEverything fine? Can we create the requests ? (y/n) ')
- if repl.lower() != 'y':
- print >>sys.stderr, 'Aborted...'
- raise oscerr.UserAbort()
-
+ next
- # loop via all packages to do the action
- for p in pac:
- result = create_submit_request(apiurl, project, p)
- if not result:
-# sys.exit(result)
- sys.exit("submit request creation failed")
- sr_ids.append(result)
-
- # create submit requests for all found patchinfos
- actionxml=""
- options_block=""
- if src_update:
- options_block="""<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
+ serviceinfo = root.find('serviceinfo')
+ if serviceinfo != None:
+ if serviceinfo.get('code') != "succeeded":
+ print "Package ", p, " has a ", serviceinfo.get('code'), " source service"
+ sys.exit("Please fix this first")
+ if serviceinfo.get('error'):
+ print "Package ", p, " contains a failed source service."
+ sys.exit("Please fix this first")
- for p in pi:
- for t in targetprojects:
+ # submitting this package
+ if opts.seperate_requests:
+ # create a single request
+ result = create_submit_request(apiurl, project, p)
+ if not result:
+ sys.exit("submit request creation failed")
+ sr_ids.append(result)
+ else:
s = """<action type="submit"> <source project="%s" package="%s" /> <target project="%s" package="%s" /> %s </action>""" % \
- (project, p, t, p, options_block)
+ (project, p, t, p, options_block)
actionxml += s
if actionxml != "":
@@ -984,18 +974,26 @@
root = ET.parse(f).getroot()
sr_ids.append(root.get('id'))
- print "Requests created: ",
+ print "Request created: ",
for i in sr_ids:
print i,
- repl = ''
- if len(myreqs) > 0 and not opts.supersede:
+ # was this project created by clone request ?
+ u = makeurl(apiurl, ['source', project, '_attribute', 'OBS:RequestCloned'])
+ f = http_GET(u)
+ root = ET.parse(f).getroot()
+ value = root.findtext('attribute/value')
+ if value:
+ repl = ''
print '\n\nThere are already following submit request: %s.' % \
', '.join([str(i) for i in myreqs ])
repl = raw_input('\nSupersede the old requests? (y/n) ')
if repl.lower() == 'y':
- for req in myreqs:
- change_request_state(apiurl, str(req), 'superseded',
+ myreqs += [ value ]
+
+ if len(myreqs) > 0:
+ for req in myreqs:
+ change_request_state(apiurl, str(req), 'superseded',
'superseded by %s' % result, result)
sys.exit('Successfully finished')
@@ -3507,6 +3505,158 @@
run_pager(rdiff)
+ def _get_branch_parent(self, prj):
+ m = re.match('^home:[^:]+:branches:(.+)', prj)
+ # OBS_Maintained is a special case
+ if m and prj.find(':branches:OBS_Maintained:') == -1:
+ return m.group(1)
+ return None
+
+ def _prdiff_skip_package(self, opts, pkg):
+ if opts.exclude and re.search(opts.exclude, pkg):
+ return True
+
+ if opts.include and not re.search(opts.include, pkg):
+ return True
+
+ return False
+
+ def _prdiff_output_diff(self, opts, rdiff):
+ if opts.diffstat:
+ print
+ p = subprocess.Popen("diffstat",
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ close_fds=True)
+ p.stdin.write(rdiff)
+ p.stdin.close()
+ diffstat = "".join(p.stdout.readlines())
+ print diffstat
+ elif opts.unified:
+ print
+ print rdiff
+ #run_pager(rdiff)
+
+ def _prdiff_output_matching_requests(self, opts, requests,
+ srcprj, pkg):
+ """
+ Search through the given list of requests and output any
+ submitrequests which target pkg and originate from srcprj.
+ """
+ for req in requests:
+ for action in req.get_actions('submit'):
+ if action.src_project != srcprj:
+ continue
+
+ if action.tgt_package != pkg:
+ continue
+
+ print
+ print req.list_view()
+ break
+
+ @cmdln.alias('projectdiff')
+ @cmdln.alias('projdiff')
+ @cmdln.option('-r', '--requests', action='store_true',
+ help='show open requests for any packages with differences')
+ @cmdln.option('-e', '--exclude', metavar='REGEXP', dest='exclude',
+ help='skip packages matching REGEXP')
+ @cmdln.option('-i', '--include', metavar='REGEXP', dest='include',
+ help='only consider packages matching REGEXP')
+ @cmdln.option('-n', '--show-not-in-old', action='store_true',
+ help='show packages only in the new project')
+ @cmdln.option('-o', '--show-not-in-new', action='store_true',
+ help='show packages only in the old project')
+ @cmdln.option('-u', '--unified', action='store_true',
+ help='show full unified diffs of differences')
+ @cmdln.option('-d', '--diffstat', action='store_true',
+ help='show diffstat of differences')
+
+ def do_prdiff(self, subcmd, opts, *args):
+ """${cmd_name}: Server-side diff of two projects
+
+ Compares two projects and either summarises or outputs the
+ differences in full. In the second form, a project is compared
+ with one of its branches inside a home:$USER project (the branch
+ is treated as NEWPRJ). The home branch is optional if the current
+ working directory is a checked out copy of it.
+
+ Usage:
+ osc prdiff [OPTIONS] OLDPRJ NEWPRJ
+ osc prdiff [OPTIONS] [home:$USER:branch:$PRJ]
+
+ ${cmd_option_list}
+ """
+
+ if len(args) > 2:
+ raise oscerr.WrongArgs('Too many arguments.')
+
+ if len(args) == 0:
+ if is_project_dir(os.curdir):
+ newprj = Project('.', getPackageList=False).name
+ oldprj = self._get_branch_parent(newprj)
+ if oldprj is None:
+ raise oscerr.WrongArgs('Current directory is not a valid home branch.')
+ else:
+ raise oscerr.WrongArgs('Current directory is not a project.')
+ elif len(args) == 1:
+ newprj = args[0]
+ oldprj = self._get_branch_parent(newprj)
+ if oldprj is None:
+ raise oscerr.WrongArgs('Single-argument form must be for a home branch.')
+ elif len(args) == 2:
+ oldprj, newprj = args
+ else:
+ raise RuntimeError('BUG in argument parsing, please report.\n'
+ 'args: ' + repr(args))
+
+ if opts.diffstat and opts.unified:
+ print >>sys.stderr, 'error - cannot specify both --diffstat and --unified'
+ sys.exit(1)
+
+ apiurl = self.get_api_url()
+
+ old_packages = meta_get_packagelist(apiurl, oldprj)
+ new_packages = meta_get_packagelist(apiurl, newprj)
+
+ if opts.requests:
+ requests = get_request_list(apiurl, project=oldprj,
+ req_state=('new', 'review'))
+
+ for pkg in old_packages:
+ if self._prdiff_skip_package(opts, pkg):
+ continue
+
+ if pkg not in new_packages:
+ if opts.show_not_in_new:
+ print "old only: %s" % pkg
+ continue
+
+ rdiff = server_diff_noex(
+ apiurl,
+ oldprj, pkg, None,
+ newprj, pkg, None,
+ unified=True, missingok=False, meta=False, expand=True
+ )
+
+ if rdiff:
+ print "differs: %s" % pkg
+ self._prdiff_output_diff(opts, rdiff)
+
+ if opts.requests:
+ self._prdiff_output_matching_requests(opts, requests,
+ newprj, pkg)
+ else:
+ print "identical: %s" % pkg
+
+ for pkg in new_packages:
+ if self._prdiff_skip_package(opts, pkg):
+ continue
+
+ if pkg not in old_packages:
+ if opts.show_not_in_old:
+ print "new only: %s" % pkg
+
@cmdln.hide(1)
@cmdln.alias('in')
def do_install(self, subcmd, opts, *args):
@@ -4380,6 +4530,8 @@
help='hide the legend')
@cmdln.option('-c', '--csv', action='store_true',
help='csv output')
+ @cmdln.option('', '--xml', action='store_true', default=False,
+ help='generate output in XML')
@cmdln.option('-s', '--status-filter', metavar='STATUS',
help='show only packages with buildstatus STATUS (see legend)')
@cmdln.option('-n', '--name-filter', metavar='EXPR',
@@ -4413,6 +4565,10 @@
wd = os.curdir
project = store_read_project(wd)
+ if opts.xml:
+ print ''.join(show_prj_results_meta(apiurl, project))
+ return
+
print '\n'.join(get_prj_results(apiurl, project, hide_legend=opts.hide_legend, csv=opts.csv, status_filter=opts.status_filter, name_filter=opts.name_filter, repo=opts.repo, arch=opts.arch, vertical=opts.vertical, show_excluded=opts.show_excluded))
@@ -4435,6 +4591,8 @@
@cmdln.alias('buildlogtail')
@cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log start or end from the offset')
+ @cmdln.option('-s', '--strip-time', action='store_true',
+ help='strip leading build time from the log')
def do_buildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package
@@ -4485,8 +4643,8 @@
offset=0
elif opts.offset:
offset = int(opts.offset)
-
- print_buildlog(apiurl, project, package, repository, arch, offset)
+ strip_time = opts.strip_time or conf.config['buildlog_strip_time']
+ print_buildlog(apiurl, project, package, repository, arch, offset, strip_time)
def print_repos(self, repos_only=False, exc_class=oscerr.WrongArgs, exc_msg='Missing arguments'):
@@ -4515,6 +4673,8 @@
@cmdln.alias('remotebuildlogtail')
@cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log starting or ending from the offset')
+ @cmdln.option('-s', '--strip-time', action='store_true',
+ help='strip leading build time from the log')
def do_remotebuildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a package
@@ -4558,12 +4718,14 @@
offset=0
elif opts.offset:
offset = int(opts.offset)
-
- print_buildlog(apiurl, project, package, repository, arch, offset)
+ strip_time = opts.strip_time or conf.config['buildlog_strip_time']
+ print_buildlog(apiurl, project, package, repository, arch, offset, strip_time)
@cmdln.alias('lbl')
@cmdln.option('-o', '--offset', metavar='OFFSET',
help='get log starting from offset')
+ @cmdln.option('-s', '--strip-time', action='store_true',
+ help='strip leading build time from the log')
def do_localbuildlog(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build log of a local buildchroot
@@ -4616,6 +4778,8 @@
f.seek(offset)
data = f.read(BUFSIZE)
while len(data):
+ if opts.strip_time or conf.config['buildlog_strip_time']:
+ data = buildlog_strip_time(data)
sys.stdout.write(data)
data = f.read(BUFSIZE)
f.close()
@@ -6495,6 +6659,7 @@
if opts.bugowner_only or opts.bugowner or opts.set_bugowner or opts.set_bugowner_request or subcmd == 'bugowner':
roles = [ 'bugowner' ]
+ args = slash_split(args)
if len(args) == 0:
try:
pac = store_read_package('.')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/osc/conf.py new/osc-0.138.0/osc/conf.py
--- old/osc-0.137.0/osc/conf.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/osc/conf.py 2013-01-31 16:46:36.000000000 +0100
@@ -103,6 +103,8 @@
'builtin_signature_check': '1', # by default use builtin check for verify pkgs
'icecream': '0',
+ 'buildlog_strip_time': '0', # strips the build time from the build log
+
'debug': '0',
'http_debug': '0',
'http_full_debug': '0',
@@ -110,8 +112,8 @@
'verbose': '1',
'traceback': '0',
'post_mortem': '0',
- 'use_keyring': '1',
- 'gnome_keyring': '1',
+ 'use_keyring': '0',
+ 'gnome_keyring': '0',
'cookiejar': '~/.osc_cookiejar',
# fallback for osc build option --no-verify
'no_verify': '0',
@@ -165,7 +167,7 @@
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist', 'plaintext_passwd',
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
'review_inherit_group', 'use_keyring', 'gnome_keyring', 'no_verify', 'builtin_signature_check', 'http_full_debug',
- 'include_request_from_project', 'local_service_run']
+ 'include_request_from_project', 'local_service_run', 'buildlog_strip_time']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
@@ -232,6 +234,9 @@
# This should not be 0
# build-uid =
+# strip leading build time information from the build log
+# buildlog_strip_time = 1
+
# extra packages to install when building packages locally (osc build)
# this corresponds to osc build's -x option and can be overridden with that
# -x '' can also be given on the command line to override this setting, or
@@ -851,6 +856,9 @@
if not config['plaintext_passwd']:
password = passwordx
+ if password is None or len(password) == 0:
+ print >>sys.stderr, 'no password defined for ', url, '.\nPlease fix your keyring entry or python-keyring setup.'
+
if cp.has_option(url, 'http_headers'):
http_headers = cp.get(url, 'http_headers')
http_headers = http_header_regexp.findall(http_headers)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/osc/core.py new/osc-0.138.0/osc/core.py
--- old/osc-0.137.0/osc/core.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/osc/core.py 2013-01-31 16:46:36.000000000 +0100
@@ -3,7 +3,7 @@
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or version 3 (at your option).
-__version__ = '0.137'
+__version__ = '0.138'
# __store_version__ is to be incremented when the format of the working copy
# "store" changes in an incompatible way. Please add any needed migration
@@ -466,11 +466,73 @@
elem.tail = i
class Project:
- """represent a project directory, holding packages"""
+ """
+ Represent a checked out project directory, holding packages.
+
+ :Attributes:
+ ``dir``
+ The directory path containing the project.
+
+ ``name``
+ The name of the project.
+
+ ``apiurl``
+ The endpoint URL of the API server.
+
+ ``pacs_available``
+ List of names of packages available server-side.
+ This is only populated if ``getPackageList`` is set
+ to ``True`` in the constructor.
+
+ ``pacs_have``
+ List of names of packages which exist server-side
+ and exist in the local project working copy (if
+ 'do_package_tracking' is disabled).
+ If 'do_package_tracking' is enabled it represents the
+ list names of packages which are tracked in the project
+ working copy (that is it might contain packages which
+ exist on the server as well as packages which do not
+ exist on the server (for instance if the local package
+ was added or if the package was removed on the server-side)).
+
+ ``pacs_excluded``
+ List of names of packages in the local project directory
+ which are excluded by the `exclude_glob` configuration
+ variable. Only set if `do_package_tracking` is enabled.
+
+ ``pacs_unvers``
+ List of names of packages in the local project directory
+ which are not tracked. Only set if `do_package_tracking`
+ is enabled.
+
+ ``pacs_broken``
+ List of names of packages which are tracked but do not
+ exist in the local project working copy. Only set if
+ `do_package_tracking` is enabled.
+
+ ``pacs_missing``
+ List of names of packages which exist server-side but
+ are not expected to exist in the local project directory.
+ """
+
REQ_STOREFILES = ('_project', '_apiurl')
if conf.config['do_package_tracking']:
REQ_STOREFILES += ('_packages',)
+
def __init__(self, dir, getPackageList=True, progress_obj=None, wc_check=True):
+ """
+ Constructor.
+
+ :Parameters:
+ `dir` : str
+ The directory path containing the checked out project.
+
+ `getPackageList` : bool
+ Set to `False` if you want to skip retrieval from the
+ server of the list of packages in the project .
+
+ `wc_check` : bool
+ """
import fnmatch
self.dir = dir
self.absdir = os.path.abspath(dir)
@@ -609,6 +671,10 @@
ET.SubElement(self.pac_root, 'package', name=name, state=state)
def read_packages(self):
+ """
+ Returns an ``xml.etree.cElementTree`` object representing the
+ parsed contents of the project's ``.osc/_packages`` XML file.
+ """
global store
packages_file = os.path.join(self.absdir, store, '_packages')
@@ -3160,7 +3226,7 @@
return data
-def make_meta_url(metatype, path_args=None, apiurl=None, force=False):
+def make_meta_url(metatype, path_args=None, apiurl=None, force=False, remove_linking_repositories=False):
global metatypes
if not apiurl:
@@ -3175,6 +3241,8 @@
query = {}
if force:
query = { 'force': '1' }
+ if remove_linking_repositories:
+ query['remove_linking_repositories'] = '1'
return makeurl(apiurl, [path], query)
@@ -3185,6 +3253,7 @@
template_args=None,
edit=False,
force=False,
+ remove_linking_repositories=False,
change_is_required=False,
apiurl=None):
@@ -3202,7 +3271,7 @@
if edit:
change_is_required = True
- url = make_meta_url(metatype, path_args, apiurl, force)
+ url = make_meta_url(metatype, path_args, apiurl, force, remove_linking_repositories)
f=metafile(url, data, change_is_required, metatypes[metatype]['file_ext'])
if edit:
@@ -5089,7 +5158,13 @@
raise oscerr.OscIOError(None, 'Content-Length is not matching file size for %s: %i vs %i file size' % (url, cl, read))
-def print_buildlog(apiurl, prj, package, repository, arch, offset = 0):
+def buildlog_strip_time(data):
+ """Strips the leading build time from the log"""
+ time_regex = re.compile('^\[\s{0,5}\d+s\]\s', re.M)
+ return time_regex.sub('', data)
+
+
+def print_buildlog(apiurl, prj, package, repository, arch, offset=0, strip_time=False):
"""prints out the buildlog on stdout"""
# to protect us against control characters
@@ -5104,6 +5179,8 @@
u = makeurl(apiurl, ['build', prj, repository, arch, package, '_log'], query=query)
for data in streamfile(u):
offset += len(data)
+ if strip_time:
+ data = buildlog_strip_time(data)
sys.stdout.write(data.translate(all_bytes, remove_bytes))
if start_offset == offset:
break
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/common.py new/osc-0.138.0/tests/common.py
--- old/osc-0.137.0/tests/common.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/tests/common.py 2013-01-31 16:46:36.000000000 +0100
@@ -106,7 +106,11 @@
class OscTestCase(unittest.TestCase):
def setUp(self, copytree=True):
- osc.core.conf.get_config(override_conffile=os.path.join(self._get_fixtures_dir(), 'oscrc'))
+ oscrc = os.path.join(self._get_fixtures_dir(), 'oscrc')
+ osc.core.conf.get_config(override_conffile=oscrc,
+ override_no_keyring=True, override_no_gnome_keyring=True)
+ os.environ['OSC_CONFIG'] = oscrc
+
self.tmpdir = tempfile.mkdtemp(prefix='osc_test')
if copytree:
shutil.copytree(os.path.join(self._get_fixtures_dir(), 'osctest'), os.path.join(self.tmpdir, 'osctest'))
@@ -156,3 +160,13 @@
continue
self.assertTrue(os.path.exists(os.path.join('.osc', i.get('name'))))
self.assertEqual(osc.core.dgst(os.path.join('.osc', i.get('name'))), i.get('md5'))
+
+ def assertEqualMultiline(self, got, exp):
+ if (got + exp).find('\n') == -1:
+ self.assertEqual(got, exp)
+ else:
+ start_delim = "\n" + (" 8< ".join(["-----"] * 8)) + "\n"
+ end_delim = "\n" + (" >8 ".join(["-----"] * 8)) + "\n\n"
+ self.assertEqual(got, exp,
+ "got:" + start_delim + got + end_delim +
+ "expected:" + start_delim + exp + end_delim)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/common-two-diff new/osc-0.138.0/tests/prdiff_fixtures/common-two-diff
--- old/osc-0.137.0/tests/prdiff_fixtures/common-two-diff 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/common-two-diff 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,10 @@
+Index: common-two
+===================================================================
+--- common-two 2013-01-18 19:18:38.225983117 +0000
++++ common-two 2013-01-18 19:19:27.882082325 +0000
+@@ -1,4 +1,5 @@
+ line one
+ line two
+ line three
++an extra line
+ last line
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_apiurl new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_apiurl
--- old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_apiurl 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_apiurl 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+http://localhost
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_packages new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_packages
--- old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_packages 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_packages 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+<project name="home:user:branches:some:project">
+ <package name="common-one" state=" " />
+ <package name="common-two" state=" " />
+</project>
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_project new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_project
--- old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_project 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/.osc/_project 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+home:user:branches:some:project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/common-two new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/common-two
--- old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/common-two 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/common-two 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,5 @@
+line one
+line two
+line three
+an extra line
+last line
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/directory new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/directory
--- old/osc-0.137.0/tests/prdiff_fixtures/home:user:branches:some:project/directory 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/home:user:branches:some:project/directory 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,6 @@
+<directory count='4'>
+ <entry name="common-one"/>
+ <entry name="common-two"/>
+ <entry name="common-three"/>
+ <entry name="only-in-new"/>
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/new:prj/common-two new/osc-0.138.0/tests/prdiff_fixtures/new:prj/common-two
--- old/osc-0.137.0/tests/prdiff_fixtures/new:prj/common-two 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/new:prj/common-two 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,5 @@
+line one
+line two
+line three
+an extra line
+last line
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/new:prj/directory new/osc-0.138.0/tests/prdiff_fixtures/new:prj/directory
--- old/osc-0.137.0/tests/prdiff_fixtures/new:prj/directory 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/new:prj/directory 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,6 @@
+<directory count='4'>
+ <entry name="common-one"/>
+ <entry name="common-two"/>
+ <entry name="common-three"/>
+ <entry name="only-in-new"/>
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/no-requests new/osc-0.138.0/tests/prdiff_fixtures/no-requests
--- old/osc-0.137.0/tests/prdiff_fixtures/no-requests 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/no-requests 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,2 @@
+<collection matches="0">
+</collection>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/old:prj/common-two new/osc-0.138.0/tests/prdiff_fixtures/old:prj/common-two
--- old/osc-0.137.0/tests/prdiff_fixtures/old:prj/common-two 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/old:prj/common-two 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+line one
+line two
+line three
+last line
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/old:prj/directory new/osc-0.138.0/tests/prdiff_fixtures/old:prj/directory
--- old/osc-0.137.0/tests/prdiff_fixtures/old:prj/directory 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/old:prj/directory 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,6 @@
+<directory count='4'>
+ <entry name="common-one"/>
+ <entry name="common-two"/>
+ <entry name="common-three"/>
+ <entry name="only-in-old"/>
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/oscrc new/osc-0.138.0/tests/prdiff_fixtures/oscrc
--- old/osc-0.137.0/tests/prdiff_fixtures/oscrc 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/oscrc 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,103 @@
+[general]
+# URL to access API server, e.g. https://api.opensuse.org
+# you also need a section [https://api.opensuse.org] with the credentials
+apiurl = http://localhost
+# Downloaded packages are cached here. Must be writable by you.
+#packagecachedir = /var/tmp/osbuild-packagecache
+# Wrapper to call build as root (sudo, su -, ...)
+#su-wrapper = su -c
+# rootdir to setup the chroot environment
+# can contain %(repo)s, %(arch)s, %(project)s and %(package)s for replacement, e.g.
+# /srv/oscbuild/%(repo)s-%(arch)s or
+# /srv/oscbuild/%(repo)s-%(arch)s-%(project)s-%(package)s
+#build-root = /var/tmp/build-root
+# compile with N jobs (default: "getconf _NPROCESSORS_ONLN")
+#build-jobs = N
+# build-type to use - values can be (depending on the capabilities of the 'build' script)
+# empty - chroot build
+# kvm - kvm VM build (needs build-device, build-swap, build-memory)
+# xen - xen VM build (needs build-device, build-swap, build-memory)
+# experimental:
+# qemu - qemu VM build
+# lxc - lxc build
+#build-type =
+# build-device is the disk-image file to use as root for VM builds
+# e.g. /var/tmp/FILE.root
+#build-device = /var/tmp/FILE.root
+# build-swap is the disk-image to use as swap for VM builds
+# e.g. /var/tmp/FILE.swap
+#build-swap = /var/tmp/FILE.swap
+# build-memory is the amount of memory used in the VM
+# value in MB - e.g. 512
+#build-memory = 512
+# build-vmdisk-rootsize is the size of the disk-image used as root in a VM build
+# values in MB - e.g. 4096
+#build-vmdisk-rootsize = 4096
+# build-vmdisk-swapsize is the size of the disk-image used as swap in a VM build
+# values in MB - e.g. 1024
+#build-vmdisk-swapsize = 1024
+# Numeric uid:gid to assign to the "abuild" user in the build-root
+# or "caller" to use the current users uid:gid
+# This is convenient when sharing the buildroot with ordinary userids
+# on the host.
+# This should not be 0
+# build-uid =
+# extra packages to install when building packages locally (osc build)
+# this corresponds to osc build's -x option and can be overridden with that
+# -x '' can also be given on the command line to override this setting, or
+# you can have an empty setting here.
+#extra-pkgs = vim gdb strace
+# build platform is used if the platform argument is omitted to osc build
+#build_repository = openSUSE_Factory
+# default project for getpac or bco
+#getpac_default_project = openSUSE:Factory
+# alternate filesystem layout: have multiple subdirs, where colons were.
+#checkout_no_colon = 0
+# local files to ignore with status, addremove, ....
+#exclude_glob = .osc CVS .svn .* _linkerror *~ #*# *.orig *.bak *.changes.*
+# keep passwords in plaintext. If you see this comment, your osc
+# already uses the encrypted password, and only keeps them in plain text
+# for backwards compatibility. Default will change to 0 in future releases.
+# You can remove the plaintext password without harm, if you do not need
+# backwards compatibility.
+#plaintext_passwd = 1
+# limit the age of requests shown with 'osc req list'.
+# this is a default only, can be overridden by 'osc req list -D NNN'
+# Use 0 for unlimted.
+#request_list_days = 0
+# show info useful for debugging
+#debug = 1
+# show HTTP traffic useful for debugging
+#http_debug = 1
+# Skip signature verification of packages used for build.
+#no_verify = 1
+# jump into the debugger in case of errors
+#post_mortem = 1
+# print call traces in case of errors
+#traceback = 1
+# use KDE/Gnome/MacOS/Windows keyring for credentials if available
+#use_keyring = 1
+# check for unversioned/removed files before commit
+#check_filelist = 1
+# check for pending requests after executing an action (e.g. checkout, update, commit)
+#check_for_request_on_action = 0
+# what to do with the source package if the submitrequest has been accepted. If
+# nothing is specified the API default is used
+#submitrequest_on_accept_action = cleanup|update|noupdate
+#review requests interactively (default: off)
+#request_show_review = 1
+# Directory with executables to validate sources, esp before committing
+#source_validator_directory = /usr/lib/osc/source_validators
+
+[http://localhost]
+user=Admin
+pass=opensuse
+# set aliases for this apiurl
+# aliases = foo, bar
+# email used in .changes, unless the one from osc meta prj <user> will be used
+# email =
+# additional headers to pass to a request, e.g. for special authentication
+#http_headers = Host: foofoobar,
+# User: mumblegack
+# Force using of keyring for this API
+#keyring = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_apiurl new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_apiurl
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_apiurl 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_apiurl 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+http://localhost
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_packages new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_packages
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_packages 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_packages 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+<project name="home:user:branches:some:project">
+ <package name="common-one" state=" " />
+ <package name="common-two" state=" " />
+</project>
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_project new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_project
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/.osc/_project 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/.osc/_project 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+home:user:branches:some:project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_apiurl new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_apiurl
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_apiurl 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_apiurl 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+http://localhost
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_files new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_files
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_files 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_files 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+<directory name="common-one" rev="f53d033d63c3d6e9a8e4493225976122" srcmd5="f53d033d63c3d6e9a8e4493225976122">
+ <linkinfo baserev="896e6d6d675d03b6934946d03a976450" lsrcmd5="0cf460222270b58e2a9a3d695b1d945d" package="common-one" project="some:project" srcmd5="8c7ed3cf5ec0b4aa20ef159fd8c51b76" />
+ <entry md5="1a4c23ccf2eb12403acbfa3258233a9d" mtime="1352816081" name="common-one.spec" size="3457" />
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_meta new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_meta
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_meta 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_meta 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,10 @@
+<package name="common-one" project="home:user:branches:some:project">
+ <title>blah</title>
+ <description>foo</description>
+ <debuginfo>
+ <enable repository="openSUSE_12.2"/>
+ <enable repository="openSUSE_Factory"/>
+ <enable repository="SLE_11_SP2"/>
+ </debuginfo>
+</package>
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_osclib_version new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_osclib_version
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_osclib_version 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_osclib_version 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_package new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_package
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_package 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_package 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+common-one
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_project new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_project
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/_project 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/_project 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+home:user:branches:some:project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/common-one.spec new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/common-one.spec
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/.osc/common-one.spec 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/.osc/common-one.spec 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+contents are irrelevant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/common-one.spec new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/common-one.spec
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-one/common-one.spec 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-one/common-one.spec 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+contents are irrelevant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_apiurl new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_apiurl
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_apiurl 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_apiurl 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+http://localhost
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_files new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_files
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_files 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_files 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+<directory name="common-two" rev="f53d033d63c3d6e9a8e4493225976122" srcmd5="f53d033d63c3d6e9a8e4493225976122">
+ <linkinfo baserev="896e6d6d675d03b6934946d03a976450" lsrcmd5="0cf460222270b58e2a9a3d695b1d945d" package="common-two" project="some:project" srcmd5="8c7ed3cf5ec0b4aa20ef159fd8c51b76" />
+ <entry md5="1a4c23ccf2eb12403acbfa3258233a9d" mtime="1352816081" name="common-two.spec" size="3457" />
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_meta new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_meta
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_meta 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_meta 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,10 @@
+<package name="common-two" project="home:user:branches:some:project">
+ <title>blah</title>
+ <description>foo</description>
+ <debuginfo>
+ <enable repository="openSUSE_12.2"/>
+ <enable repository="openSUSE_Factory"/>
+ <enable repository="SLE_11_SP2"/>
+ </debuginfo>
+</package>
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_osclib_version new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_osclib_version
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_osclib_version 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_osclib_version 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+1.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_package new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_package
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_package 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_package 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+common-two
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_project new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_project
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/_project 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/_project 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+home:user:branches:some:project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/common-two.spec new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/common-two.spec
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/.osc/common-two.spec 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/.osc/common-two.spec 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+contents are irrelevant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/common-two.spec new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/common-two.spec
--- old/osc-0.137.0/tests/prdiff_fixtures/osctest/common-two/common-two.spec 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/osctest/common-two/common-two.spec 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+contents are irrelevant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/request new/osc-0.138.0/tests/prdiff_fixtures/request
--- old/osc-0.137.0/tests/prdiff_fixtures/request 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/request 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,16 @@
+<collection matches="1">
+ <request id="148023">
+ <action type="submit">
+ <source project="home:user:branches:some:project" package="common-two" rev="7"/>
+ <target project="some:project" package="common-two"/>
+ <options>
+ <sourceupdate>update</sourceupdate>
+ </options>
+ </action>
+ <state name="new" who="user" when="2013-01-11T11:04:14">
+ <comment/>
+ </state>
+ <description>- Fix it to work
+- Improve support for something</description>
+ </request>
+</collection>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_apiurl new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_apiurl
--- old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_apiurl 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_apiurl 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+http://localhost
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_packages new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_packages
--- old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_packages 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_packages 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,4 @@
+<project name="some:project">
+ <package name="common-one" state=" " />
+ <package name="common-two" state=" " />
+</project>
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_project new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_project
--- old/osc-0.137.0/tests/prdiff_fixtures/some:project/.osc/_project 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/some:project/.osc/_project 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1 @@
+some:project
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/some:project/common-two new/osc-0.138.0/tests/prdiff_fixtures/some:project/common-two
--- old/osc-0.137.0/tests/prdiff_fixtures/some:project/common-two 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/some:project/common-two 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,5 @@
+line one
+line two
+line three
+an extra line
+last line
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/prdiff_fixtures/some:project/directory new/osc-0.138.0/tests/prdiff_fixtures/some:project/directory
--- old/osc-0.137.0/tests/prdiff_fixtures/some:project/directory 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/prdiff_fixtures/some:project/directory 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,6 @@
+<directory count='4'>
+ <entry name="common-one"/>
+ <entry name="common-two"/>
+ <entry name="common-three"/>
+ <entry name="only-in-new"/>
+</directory>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/suite.py new/osc-0.138.0/tests/suite.py
--- old/osc-0.137.0/tests/suite.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/tests/suite.py 2013-01-31 16:46:36.000000000 +0100
@@ -21,6 +21,7 @@
import test_project_status
import test_request
import test_setlinkrev
+import test_prdiff
suite = unittest.TestSuite()
suite.addTests(test_addfiles.suite())
@@ -36,6 +37,7 @@
suite.addTests(test_project_status.suite())
suite.addTests(test_request.suite())
suite.addTests(test_setlinkrev.suite())
+suite.addTests(test_prdiff.suite())
if have_xmlrunner:
result = xmlrunner.XMLTestRunner(output=os.path.join(os.getcwd(), 'junit-xml-results')).run(suite)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/test_difffiles.py new/osc-0.138.0/tests/test_difffiles.py
--- old/osc-0.137.0/tests/test_difffiles.py 2012-12-04 16:45:58.000000000 +0100
+++ new/osc-0.138.0/tests/test_difffiles.py 2013-01-31 16:46:36.000000000 +0100
@@ -1,6 +1,7 @@
import osc.core
import osc.oscerr
import os
+import re
from common import GET, OscTestCase
FIXTURES_DIR = os.path.join(os.getcwd(), 'difffile_fixtures')
@@ -295,10 +296,40 @@
self.__check_diff(p, '', 3)
def __check_diff(self, p, exp, revision=None):
- s = ''
+ got = ''
for i in p.get_diff(revision):
- s += ''.join(i)
- self.assertEqual(s, exp)
+ got += ''.join(i)
+
+ # When a hunk header refers to a single line in the "from"
+ # file and/or the "to" file, e.g.
+ #
+ # @@ -37,37 +41,43 @@
+ # @@ -37,39 +41,41 @@
+ # @@ -37,37 +41,41 @@
+ #
+ # some systems will avoid repeating the line number:
+ #
+ # @@ -37 +41,43 @@
+ # @@ -37,39 +41 @@
+ # @@ -37 +41 @@
+ #
+ # so we need to canonise the output to avoid false negative
+ # test failures.
+
+ # TODO: Package.get_diff should return a consistent format
+ # (regardless of the used python version)
+ def __canonise_diff(diff):
+ # we cannot use re.M because python 2.6's re.sub does
+ # not support a flags argument
+ diff = [re.sub('^@@ -(\d+) ', '@@ -\\1,\\1 ', line)
+ for line in diff.split('\n')]
+ diff = [re.sub('^(@@ -\d+,\d+) \+(\d+) ', '\\1 +\\2,\\2 ', line)
+ for line in diff]
+ return '\n'.join(diff)
+
+ got = __canonise_diff(got)
+ exp = __canonise_diff(exp)
+ self.assertEqualMultiline(got, exp)
if __name__ == '__main__':
import unittest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-0.137.0/tests/test_prdiff.py new/osc-0.138.0/tests/test_prdiff.py
--- old/osc-0.137.0/tests/test_prdiff.py 1970-01-01 01:00:00.000000000 +0100
+++ new/osc-0.138.0/tests/test_prdiff.py 2013-01-31 16:46:36.000000000 +0100
@@ -0,0 +1,272 @@
+import osc.commandline
+import osc.core
+import osc.oscerr
+import os
+import re
+import sys
+import urllib2
+from common import GET, POST, OscTestCase, addExpectedRequest, EXPECTED_REQUESTS
+
+
+FIXTURES_DIR = os.path.join(os.getcwd(), 'prdiff_fixtures')
+API_URL = 'http://localhost/'
+UPSTREAM = 'some:project'
+BRANCH = 'home:user:branches:' + UPSTREAM
+
+def rdiff_url(pkg, oldprj, newprj):
+ return API_URL + 'source/%s/%s?unified=1&opackage=%s&oproject=%s&cmd=diff&expand=1&filelimit=0' % \
+ (newprj, pkg, pkg, oldprj.replace(':', '%3A'))
+
+def request_url(prj):
+ return API_URL + 'search/request?match=%%28state%%2F%%40name%%3D%%27new%%27+or+state%%2F%%40name%%3D%%27review%%27%%29+and+%%28action%%2Ftarget%%2F%%40project%%3D%%27%s%%27+or+submit%%2Ftarget%%2F%%40project%%3D%%27%s%%27+or+action%%2Fsource%%2F%%40project%%3D%%27%s%%27+or+submit%%2Fsource%%2F%%40project%%3D%%27%s%%27%%29' % \
+ tuple([prj.replace(':', '%3A')] * 4)
+
+def GET_PROJECT_PACKAGES(*projects):
+ def decorator(test_method):
+ def wrapped_test_method(*args):
+ for project in projects:
+ addExpectedRequest('GET', API_URL + 'source/' + project,
+ file='%s/directory' % project)
+ test_method(*args)
+ # "rename" method otherwise we cannot specify a TestCaseClass.testName
+ # cmdline arg when using unittest.main()
+ wrapped_test_method.__name__ = test_method.__name__
+ return wrapped_test_method
+ return decorator
+
+def POST_RDIFF(oldprj, newprj):
+ def decorator(test_method):
+ def wrapped_test_method(*args):
+ addExpectedRequest('POST', rdiff_url('common-one', oldprj, newprj), exp='', text='')
+ addExpectedRequest('POST', rdiff_url('common-two', oldprj, newprj), exp='', file='common-two-diff')
+ addExpectedRequest('POST', rdiff_url('common-three', oldprj, newprj), exp='', text='')
+ test_method(*args)
+ # "rename" method otherwise we cannot specify a TestCaseClass.testName
+ # cmdline arg when using unittest.main()
+ wrapped_test_method.__name__ = test_method.__name__
+ return wrapped_test_method
+ return decorator
+
+def suite():
+ import unittest
+ return unittest.makeSuite(TestProjectDiff)
+
+class TestProjectDiff(OscTestCase):
+ diff_hdr = 'Index: %s\n==================================================================='
+ def _get_fixtures_dir(self):
+ return FIXTURES_DIR
+
+ def _change_to_tmpdir(self, *args):
+ os.chdir(os.path.join(self.tmpdir, *args))
+
+ def _run_prdiff(self, *args):
+ """Runs osc prdiff, returning captured STDOUT as a string."""
+ cli = osc.commandline.Osc()
+ argv = ['osc', '--no-keyring', '--no-gnome-keyring', 'prdiff']
+ argv.extend(args)
+ cli.main(argv=argv)
+ return sys.stdout.getvalue()
+
+
+ def testPrdiffTooManyArgs(self):
+ def runner():
+ self._run_prdiff('one', 'two', 'superfluous-arg')
+ self.assertRaises(osc.oscerr.WrongArgs, runner)
+
+
+ @GET_PROJECT_PACKAGES(UPSTREAM, BRANCH)
+ @POST_RDIFF(UPSTREAM, BRANCH)
+ @POST(rdiff_url('only-in-new', UPSTREAM, BRANCH), exp='', text='')
+ def testPrdiffZeroArgs(self):
+ exp = """identical: common-one
+differs: common-two
+identical: common-three
+identical: only-in-new
+"""
+ def runner():
+ self._run_prdiff()
+
+ os.chdir('/tmp')
+ self.assertRaises(osc.oscerr.WrongArgs, runner)
+
+ self._change_to_tmpdir(FIXTURES_DIR, UPSTREAM)
+ self.assertRaises(osc.oscerr.WrongArgs, runner)
+
+ self._change_to_tmpdir(FIXTURES_DIR, BRANCH)
+ out = self._run_prdiff()
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES(UPSTREAM, BRANCH)
+ @POST_RDIFF(UPSTREAM, BRANCH)
+ @POST(rdiff_url('only-in-new', UPSTREAM, BRANCH), exp='', text='')
+ def testPrdiffOneArg(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+identical: common-three
+identical: only-in-new
+"""
+ out = self._run_prdiff('home:user:branches:some:project')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST_RDIFF('old:prj', 'new:prj')
+ def testPrdiffTwoArgs(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+identical: common-three
+"""
+ out = self._run_prdiff('old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST_RDIFF('old:prj', 'new:prj')
+ def testPrdiffOldOnly(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+identical: common-three
+old only: only-in-old
+"""
+ out = self._run_prdiff('--show-not-in-new', 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST_RDIFF('old:prj', 'new:prj')
+ def testPrdiffNewOnly(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+identical: common-three
+new only: only-in-new
+"""
+ out = self._run_prdiff('--show-not-in-old', 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST_RDIFF('old:prj', 'new:prj')
+ def testPrdiffDiffstat(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+
+ common-two | 1 +
+ 1 file changed, 1 insertion(+)
+
+identical: common-three
+"""
+ out = self._run_prdiff('--diffstat', 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST_RDIFF('old:prj', 'new:prj')
+ def testPrdiffUnified(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+
+Index: common-two
+===================================================================
+--- common-two\t2013-01-18 19:18:38.225983117 +0000
++++ common-two\t2013-01-18 19:19:27.882082325 +0000
+@@ -1,4 +1,5 @@
+ line one
+ line two
+ line three
++an extra line
+ last line
+
+identical: common-three
+"""
+ out = self._run_prdiff('--unified', 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST(rdiff_url('common-two', 'old:prj', 'new:prj'), exp='', file='common-two-diff')
+ @POST(rdiff_url('common-three', 'old:prj', 'new:prj'), exp='', text='')
+ def testPrdiffInclude(self):
+ self._change_to_tmpdir()
+ exp = """differs: common-two
+identical: common-three
+"""
+ out = self._run_prdiff('--include', 'common-t',
+ 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST(rdiff_url('common-two', 'old:prj', 'new:prj'), exp='', file='common-two-diff')
+ @POST(rdiff_url('common-three', 'old:prj', 'new:prj'), exp='', text='')
+ def testPrdiffExclude(self):
+ self._change_to_tmpdir()
+ exp = """differs: common-two
+identical: common-three
+"""
+ out = self._run_prdiff('--exclude', 'one', 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES('old:prj', 'new:prj')
+ @POST(rdiff_url('common-two', 'old:prj', 'new:prj'), exp='', file='common-two-diff')
+ def testPrdiffIncludeExclude(self):
+ self._change_to_tmpdir()
+ exp = """differs: common-two
+"""
+ out = self._run_prdiff('--include', 'common-t',
+ '--exclude', 'three',
+ 'old:prj', 'new:prj')
+ self.assertEqualMultiline(out, exp)
+
+
+ @GET_PROJECT_PACKAGES(UPSTREAM, BRANCH)
+ @GET(request_url(UPSTREAM), exp='', file='request')
+ @POST(rdiff_url('common-one', UPSTREAM, BRANCH), exp='', text='')
+ @POST(rdiff_url('common-two', UPSTREAM, BRANCH), exp='', file='common-two-diff')
+ @POST(rdiff_url('common-three', UPSTREAM, BRANCH), exp='', file='common-two-diff')
+ @POST(rdiff_url('only-in-new', UPSTREAM, BRANCH), exp='', text='')
+ def testPrdiffRequestsMatching(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+
+148023 State:new By:user When:2013-01-11T11:04:14
+ submit: home:user:branches:some:project/common-two -> some:project
+ Descr: - Fix it to work - Improve support for something
+
+differs: common-three
+identical: only-in-new
+"""
+ out = self._run_prdiff('--requests', UPSTREAM, BRANCH)
+ self.assertEqualMultiline(out, exp)
+
+
+ # Reverse the direction of the diff.
+ @GET_PROJECT_PACKAGES(BRANCH, UPSTREAM)
+ @GET(request_url(BRANCH), exp='', file='no-requests')
+ @POST(rdiff_url('common-one', BRANCH, UPSTREAM), exp='', text='')
+ @POST(rdiff_url('common-two', BRANCH, UPSTREAM), exp='', file='common-two-diff')
+ @POST(rdiff_url('common-three', BRANCH, UPSTREAM), exp='', file='common-two-diff')
+ @POST(rdiff_url('only-in-new', BRANCH, UPSTREAM), exp='', text='')
+ def testPrdiffRequestsSwitched(self):
+ self._change_to_tmpdir()
+ exp = """identical: common-one
+differs: common-two
+differs: common-three
+identical: only-in-new
+"""
+ out = self._run_prdiff('--requests', BRANCH, UPSTREAM)
+ self.assertEqualMultiline(out, exp)
+
+
+
+if __name__ == '__main__':
+ import unittest
+ unittest.main()
++++++ osc.dsc ++++++
--- /var/tmp/diff_new_pack.KGh0Hd/_old 2013-02-01 09:49:28.000000000 +0100
+++ /var/tmp/diff_new_pack.KGh0Hd/_new 2013-02-01 09:49:28.000000000 +0100
@@ -1,6 +1,6 @@
Format: 1.0
Source: osc
-Version: 0.137.0
+Version: 0.138.0
Binary: osc
Maintainer: Adrian Schroeter