Make a copy of the current instance, but with a new rev.

        Args:
          rev: the name of the revision for the new object.
778550
def make_new(self, rev):
        # type: (str) -> RevOptions
        
        return self.vcs.make_rev_options(rev, extra_args=self.extra_args)
642637
def _rev(repo):
    '''
    
    '''
    try:
        repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
    except (pysvn._pysvn.ClientError, TypeError,
            KeyError, AttributeError) as exc:
        log.error(
            'Error retrieving revision ID for svnfs remote %s '
            '(cachedir: %s): %s',
            repo['url'], repo['repo'], exc
        )
    else:
        return repo_info['revision'].number
    return None
673573
def duplicate(self, b):
        

        on = b.identity.on
        on.revision = on.revision + 1

        try:
            extant = self.bundle(str(on))

            if extant:
                raise ConflictError('Already have a bundle with vid: {}'.format(str(on)))
        except NotFoundError:
            pass

        d = b.dataset.dict
        d['revision'] = on.revision
        d['vid'] = str(on)
        del d['name']
        del d['vname']
        del d['version']
        del d['fqname']
        del d['cache_key']

        ds = self.database.new_dataset(**d)

        nb = self.bundle(ds.vid)
        nb.set_file_system(source_url=b.source_fs.getsyspath('/'))
        nb.state = Bundle.STATES.NEW

        nb.commit()

        # Copy all of the files.
        for f in b.dataset.files:
            assert f.major_type == f.MAJOR_TYPE.BUILDSOURCE
            nb.dataset.files.append(nb.dataset.bsfile(f.minor_type, f.path).update(f))

        # Load the metadata in to records, then back out again. The objects_to_record process will set the
        # new identity object numbers in the metadata file
        nb.build_source_files.file(File.BSFILE.META).record_to_objects()
        nb.build_source_files.file(File.BSFILE.META).objects_to_record()

        ds.commit()

        return nb
161564
def on_revert(request, page_name):
    """"""
    rev_id = request.args.get("rev", type=int)

    old_revision = page = None
    error = "No such revision"

    if request.method == "POST" and request.form.get("cancel"):
        return redirect(href(page_name))

    if rev_id:
        old_revision = Revision.query.filter(
            (Revision.revision_id == rev_id)
            & (Revision.page_id == Page.page_id)
            & (Page.name == page_name)
        ).first()
        if old_revision:
            new_revision = (
                Revision.query.filter(
                    (Revision.page_id == Page.page_id) & (Page.name == page_name)
                )
                .order_by(Revision.revision_id.desc())
                .first()
            )
            if old_revision == new_revision:
                error = "You tried to revert the current active revision."
            elif old_revision.text == new_revision.text:
                error = (
                    "There are no changes between the current "
                    "revision and the revision you want to "
                    "restore."
                )
            else:
                error = ""
                page = old_revision.page
                if request.method == "POST":
                    change_note = request.form.get("change_note", "")
                    change_note = "revert" + (change_note and ": " + change_note or "")
                    session.add(Revision(page, old_revision.text, change_note))
                    session.commit()
                    return redirect(href(page_name))

    return Response(
        generate_template(
            "action_revert.html", error=error, old_revision=old_revision, page=page
        )
    )
71816
def create(cls, description="", message=""):
        
        instance = cls()
        instance.revision_id = make_hash_id()
        instance.release_date = datetime.datetime.now()

        if len(description) > 0:
            instance.description = description

        if len(message) > 0:
            instance.message = message

        return instance
305474
def clone(cls, variable, **kwargs):
        
        return cls(variable.name, lb=variable.lb, ub=variable.ub, type=variable.type, **kwargs)
437241
def update(self):
        

        with self.lock:
            # Increment revision and commit it.
            self.revision += 1
            self.server.commit(self.revision + 1)

            # Unblock all waiting clients.
            self.next_revision_available.set()
            self.next_revision_available.clear()

            # Check sessions to see which revision can be removed.
            if self.sessions:
                lowest_revision = min(
                    session.revision for session in self.sessions.itervalues())

                # Remove all old revision history
                if lowest_revision == self.revision:
                    self.server.clean(lowest_revision)

        # Invoke hooks
        invoke_hooks(self.hooks, "updated", self.revision)
569237
def prepare_revision
      return if new_record?
      if (respond_to?(:fragments_attributes_changed) && fragments_attributes_changed) ||
        !(changed & revision_fields).empty?
        self.revision_data = revision_fields.each_with_object({}) do |field, c|
          c[field] = send("#{field}_was")
        end
      end
    end
1149340
def increment(cls, v):
        """"""
        if not isinstance(v, ObjectNumber):
            v = ObjectNumber.parse(v)

        return v.rev(v.revision+1)
1003231
def create_revision!
      revision_options = self.class.acts_as_revisionable_options
      revision = revision_record_class.new(self, revision_options[:encoding])
      if revision_options[:meta].is_a?(Hash)
        revision_options[:meta].each do |attribute, value|
          set_revision_meta_attribute(revision, attribute, value)
        end
      elsif revision_options[:meta].is_a?(Array)
        revision_options[:meta].each do |attribute|
          set_revision_meta_attribute(revision, attribute, attribute.to_sym)
        end
      elsif revision_options[:meta]
        set_revision_meta_attribute(revision, revision_options[:meta], revision_options[:meta].to_sym)
      end
      revision.save!
      return revision
    end
369500
def copy(self):
        """"""
        ret = self.__class__(self.callback, **self.__original_kwargs__)
        return self._ensure_assignment_on_copy(ret)
631438
def save(self, revision):
        
        if not isinstance(revision, Revision):
            raise InvalidArgType()

        self.state.update(revision)
1043748
def copy(self):
        """"""
        return self.__class__(key=self._key, load=self._load, _set=set(self._set))
676548
def create_new(cls, oldvalue, *args):
    ""
    if oldvalue is not None:
        raise AlreadyExistsException('%r already exists' % (oldvalue,))
    return cls.create_instance(*args)
601302
def copy(self, inheritance=False):
        # type: (bool) -> FactoryContext
        
        # Create a new factory context and duplicate its values
        new_context = FactoryContext()
        for field in self.__slots__:
            if not field.startswith("_"):
                setattr(
                    new_context, field, self._deepcopy(getattr(self, field))
                )

        if inheritance:
            # Store configuration as inherited one
            new_context.__inherited_configuration = self.__handlers.copy()
            new_context.__handlers = {}

        # Remove instances in any case
        new_context.__instances.clear()
        new_context.is_singleton_active = False
        return new_context
144437
def copy(self):
        
        new_term = PauliTerm("I", 0, 1.0)  # create new object
        # manually copy all attributes over
        for key in self.__dict__.keys():
            val = self.__dict__[key]
            if isinstance(val, (dict, list, set)):  # mutable types
                new_term.__dict__[key] = copy.copy(val)
            else:  # immutable types
                new_term.__dict__[key] = val

        return new_term
885148
def copy(self):
        """"""
        new_dict = IDict(std=self._std)
        new_dict.update(self.store)
        return new_dict