~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/devscripts/sourcecode.py

  • Committer: Curtis Hovey
  • Date: 2011-05-27 21:53:34 UTC
  • mto: This revision was merged to the branch mainline in revision 13136.
  • Revision ID: curtis.hovey@canonical.com-20110527215334-jqlkmt52nnl4bpeh
Moved launchpad.event into registry interfaces.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
        optional = False
64
64
    return branch_name, branch_url, revision, optional
65
65
 
66
 
 
67
66
def load_cache(cache_filename):
68
67
    try:
69
68
        cache_file = open(cache_filename, 'rb')
75
74
    with cache_file:
76
75
        return json.load(cache_file)
77
76
 
78
 
 
79
77
def interpret_config(config_entries, public_only):
80
78
    """Interpret a configuration stream, as parsed by 'parse_config_file'.
81
79
 
216
214
 
217
215
def update_cache(cache, cache_filename, changed, sourcecode_directory, quiet):
218
216
    """Update the cache with the changed branches."""
219
 
    old_cache = dict(cache)
 
217
    if len(changed) == 0:
 
218
        return
 
219
    if not quiet:
 
220
        print 'Cache updated.  Please commit "%s".' % cache_filename
220
221
    for project, (branch_url, revision, optional) in changed.iteritems():
221
222
        destination = os.path.join(sourcecode_directory, project)
222
223
        branch = Branch.open(destination)
223
 
        cache[project] = list(branch.last_revision_info())
224
 
    if cache == old_cache:
225
 
        return
 
224
        cache[project] = branch.last_revision_info()
226
225
    with open(cache_filename, 'wb') as cache_file:
227
226
        json.dump(cache, cache_file, indent=4)
228
 
    if not quiet:
229
 
        print 'Cache updated.  Please commit "%s".' % cache_filename
230
227
 
231
228
 
232
229
def update_branches(sourcecode_directory, update_branches,
261
258
                remote_branch, stop_revision=revision_id, overwrite=True,
262
259
                possible_transports=possible_transports)
263
260
        except IncompatibleRepositories:
264
 
            # XXX JRV 20100407: Ideally remote_branch.bzrdir._format
 
261
            # XXX JRV 20100407: Ideally remote_branch.bzrdir._format 
265
262
            # should be passed into upgrade() to ensure the format is the same
266
 
            # locally and remotely. Unfortunately smart server branches
267
 
            # have their _format set to RemoteFormat rather than an actual
 
263
            # locally and remotely. Unfortunately smart server branches 
 
264
            # have their _format set to RemoteFormat rather than an actual 
268
265
            # format instance.
269
266
            upgrade(destination)
270
267
            # Upgraded, repoen working tree