Creates an audit entry, which is much like a snapshot in that
        it references versions and provides some history of the changes made.
511606
def _write_audit(self, user, message, changed_version):
        
        audit = {'_id': bson.ObjectId(),
                 'user': user,
                 'message': message,
                 'symbol': changed_version.symbol
                 }
        orig_version = changed_version.orig_version.version
        new_version = changed_version.new_version.version
        audit['orig_v'] = orig_version
        audit['new_v'] = new_version
        # Update the versions to contain the audit
        mongo_retry(self._versions.update_many)({'symbol': changed_version.symbol,
                                                 'version': {'$in': [orig_version, new_version]}
                                                 },
                                                {'$addToSet': {'parent': audit['_id']}})
        # Create the audit entry
        mongo_retry(self._audit.insert_one)(audit)
1204541
public List<Change> calculateDiffs(List<CdoSnapshot> snapshots, Map<SnapshotIdentifier, CdoSnapshot> previousSnapshots) {
        Validate.argumentsAreNotNull(snapshots);
        Validate.argumentsAreNotNull(previousSnapshots);

        List<Change> changes = new ArrayList<>();
        for (CdoSnapshot snapshot : snapshots) {
            if (snapshot.isInitial()) {
                addInitialChanges(changes, snapshot);
            } else if (snapshot.isTerminal()) {
                addTerminalChanges(changes, snapshot);
            } else {
                CdoSnapshot previousSnapshot = previousSnapshots.get(SnapshotIdentifier.from(snapshot).previous());
                addChanges(changes, previousSnapshot, snapshot);
            }
        }
        return changes;
    }
1323246
def make_report(storage_directory, old_pins, new_pins, do_update=False,
                version_mappings=None):
    """"""
    report = ""
    version_mappings = version_mappings or {}
    for new_pin in new_pins:
        repo_name, repo_url, commit_sha = new_pin
        commit_sha = version_mappings.get(repo_name, {}
                                          ).get(commit_sha, commit_sha)

        # Prepare our repo directory and clone the repo if needed. Only pull
        # if the user requests it.
        repo_dir = "{0}/{1}".format(storage_directory, repo_name)
        update_repo(repo_dir, repo_url, do_update)

        # Get the old SHA from the previous pins. If this pin didn't exist
        # in the previous OSA revision, skip it. This could happen with newly-
        # added projects and roles.
        try:
            commit_sha_old = next(x[2] for x in old_pins if x[0] == repo_name)
        except Exception:
            continue
        else:
            commit_sha_old = version_mappings.get(repo_name, {}
                                                  ).get(commit_sha_old,
                                                        commit_sha_old)

        # Loop through the commits and render our template.
        validate_commits(repo_dir, [commit_sha_old, commit_sha])
        commits = get_commits(repo_dir, commit_sha_old, commit_sha)
        template_vars = {
            'repo': repo_name,
            'commits': commits,
            'commit_base_url': get_commit_url(repo_url),
            'old_sha': commit_sha_old,
            'new_sha': commit_sha
        }
        rst = render_template('offline-repo-changes.j2', template_vars)
        report += rst

    return report
89529
def addLogEntry(self, entry, save=True):
        """"""
        # create log directory if it doesn't exist
        # error will be thrown if this is not possible
        _busy = Purr.BusyIndicator()
        self._initIndexDir()
        # discard temporary watchers -- these are only used to keep track of
        # deleted files
        self.temp_watchers = {}
        # ignored entries are only there to carry info on ignored data products
        # All we do is save them, and update DP policies based on them
        if entry.ignore:
            entry.save(self.logdir)
        # proper entries are added to list
        else:
            self.entries.append(entry)
            Purr.progressMessage("Saving new log entry")
            # find previous entry -- skip over "ignore" entries
            for prev in self.entries[-2::-1]:
                if not prev.ignore:
                    break
            else:
                prev = None
            entry.setLogDirectory(self.logdir)
            entry.setPrevUpNextLinks(prev=prev, up=os.path.join("..", Purr.RenderIndex.INDEX))
            entry.save()
            self.timestamp = self.last_scan_timestamp
            # regenerate links of previous entry
            prev and prev.generateIndex()
            # and our log may need to be regenerated
            if save:
                self.save()
        self.updatePoliciesFromEntry(entry, new=True)
904036
def setLogEntries(self, entries, save=True, update_policies=True):
        """"""
        prev = None;  # "previous" valid entry for "Prev" link
        uplink = os.path.join("..", Purr.RenderIndex.INDEX);  # "Up" link
        self.entries = []
        for entry in entries:
            if not entry.ignore:
                entry.setPrevUpNextLinks(prev=prev, up=uplink)
                prev = entry
                self.entries.append(entry)
        if save:
            self.save()
        if update_policies:
            # populate default policies and renames based on entry list
            self._default_dp_props = {}
            for entry in entries:
                self.updatePoliciesFromEntry(entry)
            dprint(4, "default policies:", self._default_dp_props)
1252645
function() {
			// Stack for all the undo and redo snapshots, they're always created/removed
			// in consistency.
			this.snapshots = [];

			// Current snapshot history index.
			this.index = -1;

			this.currentImage = null;

			this.hasUndo = false;
			this.hasRedo = false;
			this.locked = null;

			this.resetType();
		}
96058
function makeAccessedObserver() {
      return Observer(object, function(changes) {
        changes.forEach(({type, name}) => {
          var {names} = accessEntry;
          if (!names || type === 'update' && names.indexOf(name) !== -1)
            rerun();
        });
      });
    }
108882
def construct_entry_with_release(focus, issues, manager, log, releases, rest):
    
    log("release for line %r" % focus.minor)
    # Check for explicitly listed issues first
    explicit = None
    if rest[0].children:
        explicit = [x.strip() for x in rest[0][0].split(',')]
    # Do those by themselves since they override all other logic
    if explicit:
        log("Explicit issues requested: %r" % (explicit,))
        # First scan global issue dict, dying if not found
        missing = [i for i in explicit if i not in issues]
        if missing:
            raise ValueError(
                "Couldn't find issue(s) #{} in the changelog!".format(
                    ', '.join(missing)))
        # Obtain the explicitly named issues from global list
        entries = []
        for i in explicit:
            for flattened_issue_item in itertools.chain(issues[i]):
                entries.append(flattened_issue_item)
        # Create release
        log("entries in this release: %r" % (entries,))
        releases.append({
            'obj': focus,
            'entries': entries,
        })
        # Introspect these entries to determine which buckets they should get
        # removed from (it's not "all of them"!)
        for obj in entries:
            if obj.type == 'bug':
                # Major bugfix: remove from unreleased_feature
                if obj.major:
                    log("Removing #%s from unreleased" % obj.number)
                    # TODO: consider making a LineManager method somehow
                    manager[focus.family]['unreleased_feature'].remove(obj)
                # Regular bugfix: remove from bucket for this release's
                # line + unreleased_bugfix
                else:
                    if obj in manager[focus.family]['unreleased_bugfix']:
                        log("Removing #%s from unreleased" % obj.number)
                        manager[focus.family]['unreleased_bugfix'].remove(obj)
                    if obj in manager[focus.family][focus.minor]:
                        log("Removing #%s from %s" % (obj.number, focus.minor))
                        manager[focus.family][focus.minor].remove(obj)
            # Regular feature/support: remove from unreleased_feature
            # Backported feature/support: remove from bucket for this
            # release's line (if applicable) + unreleased_feature
            else:
                log("Removing #%s from unreleased" % obj.number)
                manager[focus.family]['unreleased_feature'].remove(obj)
                if obj in manager[focus.family].get(focus.minor, []):
                    manager[focus.family][focus.minor].remove(obj)

    # Implicit behavior otherwise
    else:
        # Unstable prehistory -> just dump 'unreleased' and continue
        if manager.unstable_prehistory:
            # TODO: need to continue making LineManager actually OO, i.e. do
            # away with the subdicts + keys, move to sub-objects with methods
            # answering questions like "what should I give you for a release"
            # or whatever
            log("in unstable prehistory, dumping 'unreleased'")
            releases.append({
                'obj': focus,
                # NOTE: explicitly dumping 0, not focus.family, since this
                # might be the last pre-historical release and thus not 0.x
                'entries': manager[0]['unreleased'][:],
            })
            manager[0]['unreleased'] = []
            # If this isn't a 0.x release, it signals end of prehistory, make a
            # new release bucket (as is also done below in regular behavior).
            # Also acts like a sentinel that prehistory is over.
            if focus.family != 0:
                manager[focus.family][focus.minor] = []
        # Regular behavior from here
        else:
            # New release line/branch detected. Create it & dump unreleased
            # features.
            if focus.minor not in manager[focus.family]:
                log("not seen prior, making feature release & bugfix bucket")
                manager[focus.family][focus.minor] = []
                # TODO: this used to explicitly say "go over everything in
                # unreleased_feature and dump if it's feature, support or major
                # bug". But what the hell else would BE in unreleased_feature?
                # Why not just dump the whole thing??
                #
                # Dump only the items in the bucket whose family this release
                # object belongs to, i.e. 1.5.0 should only nab the 1.0
                # family's unreleased feature items.
                releases.append({
                    'obj': focus,
                    'entries': manager[focus.family]['unreleased_feature'][:],
                })
                manager[focus.family]['unreleased_feature'] = []

            # Existing line -> empty out its bucket into new release.
            # Skip 'major' bugs as those "belong" to the next release (and will
            # also be in 'unreleased_feature' - so safe to nuke the entire
            # line)
            else:
                log("pre-existing, making bugfix release")
                # TODO: as in other branch, I don't get why this wasn't just
                # dumping the whole thing - why would major bugs be in the
                # regular bugfix buckets?
                entries = manager[focus.family][focus.minor][:]
                releases.append({'obj': focus, 'entries': entries})
                manager[focus.family][focus.minor] = []
                # Clean out the items we just released from
                # 'unreleased_bugfix'.  (Can't nuke it because there might
                # be some unreleased bugs for other release lines.)
                for x in entries:
                    if x in manager[focus.family]['unreleased_bugfix']:
                        manager[focus.family]['unreleased_bugfix'].remove(x)
413534
def cli(env, volume_id, notes):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    snapshot = block_manager.create_snapshot(volume_id, notes=notes)

    if 'id' in snapshot:
        click.echo('New snapshot created with id: %s' % snapshot['id'])
    else:
        click.echo('Error occurred while creating snapshot.\n'
                   'Ensure volume is not failed over or in another '
                   'state which prevents taking snapshots.')
241430
@Override
  public void recordTaskNameChange(String taskId, String taskName) {
    if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
      HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(taskId);
      if (historicTaskInstance != null) {
        historicTaskInstance.setName(taskName);
      }
    }
  }
103350
def _create_log_entry(self, log_record_pyxb):
        
        event_log_model = d1_gmn.app.event_log.create_log_entry(
            d1_gmn.app.model_util.get_sci_model(
                d1_common.xml.get_req_val(log_record_pyxb.identifier)
            ),
            log_record_pyxb.event,
            log_record_pyxb.ipAddress,
            log_record_pyxb.userAgent,
            log_record_pyxb.subject.value(),
        )
        event_log_model.timestamp = d1_common.date_time.normalize_datetime_to_utc(
            log_record_pyxb.dateLogged
        )
        event_log_model.save()
369828
private Snapshot createMemorySnapshot(SnapshotDescriptor descriptor) {
    HeapBuffer buffer = HeapBuffer.allocate(SnapshotDescriptor.BYTES, Integer.MAX_VALUE);
    Snapshot snapshot = new MemorySnapshot(buffer, descriptor.copyTo(buffer), this);
    LOGGER.debug("Created memory snapshot: {}", snapshot);
    return snapshot;
  }
1334240
@Override
  public void recordTaskDefinitionKeyChange(String taskId, String taskDefinitionKey) {
    if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
      HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(taskId);
      if (historicTaskInstance != null) {
        historicTaskInstance.setTaskDefinitionKey(taskDefinitionKey);
      }
    }
  }
98192
def make_snapshot(self):
        
        filename = join(self.output_dir, '{:010d}.pkl'.format(self.model.i))
        output_utils.model_to_file(self.model, filename)
798076
function createTemporaryVersion()
    {
        $db = eZDB::instance();
        $db->begin();

        $newRole = eZRole::createNew();
        $this->copyPolicies( $newRole->attribute( 'id' ) );
        $newRole->setAttribute( 'name', $this->attribute( 'name' ) );
        $newRole->setAttribute( 'version', $this->attribute( 'id' ) );
        $newRole->store();

        $db->commit();
        return $newRole;
    }
524137
function addVersionJSONToChangelog(version, changes) {
	if (!changelog) readChangelog();
	var entry = '\n\n## ' + version;

	changes.forEach(function(change) {
		entry += '\n* ' + change.type + ': ' + change.category + ': ' +
			change.description;
	});

	var logParts = changelog.split(insertMarker);
	logParts[0] = logParts[0]
		.replace(versionMarkerReg, versionMarker.join(version)) + insertMarker;
	changelog = logParts.join(entry);
}
1094296
def changes(since, out_file, eager):
    """"""
    root = get_root()
    history_data = defaultdict(lambda: {'lines': deque(), 'releasers': set()})

    with chdir(root):
        result = run_command(
            (
                'git log "--pretty=format:%H %s" --date-order --date=iso8601 '
                '--since="{}T00:00:00" */CHANGELOG.md'.format(since)
            ),
            capture=True,
            check=True,
        )

        for result_line in result.stdout.splitlines():
            commit_hash, commit_subject = result_line.split(' ', 1)

            if not eager and 'release' not in commit_subject.lower():
                continue

            result = run_command(
                'git show "--pretty=format:%an%n" -U0 {} */CHANGELOG.md'.format(commit_hash), capture=True, check=True
            )

            # Example:
            #
            # <AUTHOR NAME>
            # diff --git a/<INTEGRATION NAME 1>/CHANGELOG.md b/<INTEGRATION NAME 1>/CHANGELOG.md
            # index 89b5a3441..9534019a9 100644
            # --- a/<INTEGRATION NAME 1>/CHANGELOG.md
            # +++ b/<INTEGRATION NAME 1>/CHANGELOG.md
            # @@ -2,0 +3,5 @@
            # +## <RELEASE VERSION> / <RELEASE DATE>
            # +
            # +* <ENTRY>
            # +* <ENTRY>
            # +
            # diff --git a/<INTEGRATION NAME 2>/CHANGELOG.md b/<INTEGRATION NAME 2>/CHANGELOG.md
            # index 89b5a3441..9534019a9 100644
            # --- a/<INTEGRATION NAME 2>/CHANGELOG.md
            # +++ b/<INTEGRATION NAME 2>/CHANGELOG.md
            # @@ -2,0 +3,4 @@
            # +## <RELEASE VERSION> / <RELEASE DATE>
            # +
            # +* <ENTRY>
            # +
            lines = deque(result.stdout.splitlines())
            author_name = lines.popleft().strip()

            patches = []
            for line in lines:
                if line:
                    # New patch
                    if line.startswith('diff --git'):
                        patches.append([])
                    patches[-1].append(line)

            for patch in patches:
                integration = patch[0].split('/')[-2].strip()
                history_data[integration]['releasers'].add(author_name)

                additions = deque()
                for line in reversed(patch):
                    if line.startswith('+'):
                        line = line[1:]
                        # Demote releases to h3
                        if line.startswith('##'):
                            line = '#{}'.format(line)
                        additions.append(line)
                    elif line.startswith('@@'):
                        break

                # Get rid of the header for new integrations
                if additions[-1].startswith('# '):
                    additions.pop()

                # Get rid of blank lines to ensure consistency
                while not additions[0].strip():
                    additions.popleft()
                while not additions[-1].strip():
                    additions.pop()

                history_data[integration]['lines'].appendleft('')
                history_data[integration]['lines'].extendleft(additions)

    output_lines = ['# Changes since {}'.format(since), '']

    for integration, history in sorted(iteritems(history_data)):
        display_name = load_manifest(integration).get('display_name', integration)
        output_lines.append('## {}'.format(display_name))
        output_lines.append('released by: {}'.format(', '.join(sorted(history['releasers']))))

        output_lines.append('')
        output_lines.extend(history['lines'])

    output = '\n'.join(output_lines)

    if out_file:
        write_file(out_file, output)
    else:
        echo_info(output)