Diff this file with the gist on github
163219
def gist_diff():
    """"""
    remote_file = wget(RAW_GIST)
    proc = subprocess.Popen(('diff - %s'%MY_PATH).split(),
                            stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
    stdout, stderr = proc.communicate(remote_file)
    return stdout
600828
def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet, base=github.GithubObject.NotSet):
        
        assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title
        assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body
        assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state
        assert base is github.GithubObject.NotSet or isinstance(base, (str, unicode)), base
        post_parameters = dict()
        if title is not github.GithubObject.NotSet:
            post_parameters["title"] = title
        if body is not github.GithubObject.NotSet:
            post_parameters["body"] = body
        if state is not github.GithubObject.NotSet:
            post_parameters["state"] = state
        if base is not github.GithubObject.NotSet:
            post_parameters["base"] = base
        headers, data = self._requester.requestJsonAndCheck(
            "PATCH",
            self.url,
            input=post_parameters
        )
        self._useAttributes(data)
1158590
def fetch_compare(older, newer)
      unless @compares["#{older}...#{newer}"]
        compare_data = check_github_response { @client.compare(user_project, older, newer || "HEAD") }
        raise StandardError, "Sha #{older} and sha #{newer} are not related; please file a github-changelog-generator issues and describe how to replicate this issue." if compare_data["status"] == "diverged"

        @compares["#{older}...#{newer}"] = stringify_keys_deep(compare_data.to_hash)
      end
      @compares["#{older}...#{newer}"]
    end
1351493
function bumpVersion() {
  const versionList = gitVersionInfo(packageJson.version);
  const targetBranch = 'master';
  const repoURL = packageJson.repository.url.replace(/(?:git\+|\.git)/g, '');

  gitPorcelainStatus()
    .then(status => {
      if (status.currentBranch !== targetBranch) {
        log.error(
          `${chalk.bold('Working on the wrong branch!')}`,
          `All tags must be created on ${chalk.bold(targetBranch)} branch. Please push your work and`,
          `create a Pull Request to ${chalk.bold(targetBranch)}. Then you can continue this process.`
        );
      }

      if (!status.clean) {
        log.error(`${chalk.bold('Working dirty!')}`, 'Please commit before trying again!');
      }

      log.info(`Current version in package.json is ${chalk.bold(versionList.current)}\n`);

      return inquirer.prompt([
        {
          type: 'list',
          name: 'newVersion',
          message: 'How would you like to bump it?',
          choices: versionList.prompt
        }
      ]);
    })
    .then(answers => {
      packageJson.version = answers.newVersion;
      packageLock.version = answers.newVersion;

      // Update Package files
      return Promise.all([
        promiseWriteFile(path.join(cwd, 'package.json'), packageJson, 2),
        promiseWriteFile(path.join(cwd, 'package-lock.json'), packageLock, 2)
      ]);
    })
    .then(([rewritePKG, rewritePKGLOCK]) => {
      log.success(
        `Version bumped in the following file:`,
        `${figures.arrowRight} ${rewritePKG.fileName}`,
        `${figures.arrowRight} ${rewritePKGLOCK.fileName}`
      );

      return gitTagsInfo(`v${packageJson.version}`);
    })
    .then(([tagsList, firstCommit]) =>
      changelog(
        // Object with all the tags info.
        tagsList,
        // First commit.
        firstCommit.trim(),
        // URL of the repository.
        repoURL,
        // Name of the repository.
        capitalize(packageJson.name.replace(/-/g, ' '))
      )
    )
    .then(result => {
      var filesToAdd = ['changelog/', 'package.json', 'package-lock.json'];
      var resultLog = result.reduce((prev, { fileName }) => prev.concat(`${figures.arrowRight} ${fileName}`), []);

      log.success(`Changelog:`, ...resultLog);

      log.info(`Pushing new tag to ${chalk.bold('origin')}...`);

      return git(`add ${filesToAdd.join(' ')}`);
    })
    .then(() => {
      var commitMessage = `Bump version to ${packageJson.version}`;

      return git(`commit -m "${commitMessage}"`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`push origin ${targetBranch}`, gitParseOutput);
    })
    .then(status => {
      log(...status);

      return git(`tag -a -m "Tag version ${packageJson.version}." "v${packageJson.version}"`);
    })
    .then(() => git('git push origin --tags', gitParseOutput))
    .then(status => {
      var publicURL = `${repoURL}/releases/tag/v${packageJson.version}`;

      log(...status);

      log.success(`Release v${packageJson.version} was generated!`);

      log(`Please go to: ${chalk.underline(publicURL)}`, 'to describe the new changes/features added in this release.');

      return opn(publicURL, { wait: false });
    })
    .catch(log.error);
}
590461
def process_full_diff
        defaults = {
          :mode => '',
          :src => '',
          :dst => '',
          :type => 'modified'
        }
        final = {}
        current_file = nil
        if @full_diff.encoding.name != "UTF-8"
          full_diff_utf8_encoded = @full_diff.encode("UTF-8", "binary", { :invalid => :replace, :undef => :replace })
        else
          full_diff_utf8_encoded = @full_diff
        end
        full_diff_utf8_encoded.split("\n").each do |line|
          if m = /^diff --git a\/(.*?) b\/(.*?)/.match(line)
            current_file = m[1]
            final[current_file] = defaults.merge({:patch => line, :path => current_file})
          else
            if m = /^index (.......)\.\.(.......)( ......)*/.match(line)
              final[current_file][:src] = m[1]
              final[current_file][:dst] = m[2]
              final[current_file][:mode] = m[3].strip if m[3]
            end
            if m = /^([[:alpha:]]*?) file mode (......)/.match(line)
              final[current_file][:type] = m[1]
              final[current_file][:mode] = m[2]
            end
            if m = /^Binary files /.match(line)
              final[current_file][:binary] = true
            end
            final[current_file][:patch] << "\n" + line
          end
        end
        final.map { |e| [e[0], DiffFile.new(@base, e[1])] }
      end
280318
function(args) {
    var mode = (args && args['mode']) || 'update';
    return map(function(code, filename) {
        var lines = code.toString().split("\n");
        var gists = {};
        var currentGist = null;
        var lineNo = 0;
        lines.forEach(function(line) {
            if (line.indexOf("// startgist:") > -1 || line.indexOf("# startgist:") > -1) {
                if (currentGist) {
                    throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + ": Unexpected startgist: a previous gist was not closed");
                }
                currentGist = {
                    "id": line.split(":")[1].trim(),
                    "filename": line.split(":")[2].trim(),
                    "lines": []
                };
            } else if (line.indexOf("// endgist") > -1 || line.indexOf("# endgist") > -1) {
                if (!currentGist) {
                    throw new PluginError(PLUGIN_NAME, filename + ":" + lineNo + " Unexpected endgist: missing startgist earlier");
                }
                if (!gists[currentGist.id]) {
                    gists[currentGist.id] = {};
                }
                gists[currentGist.id][currentGist.filename] = {
                    'content': leftAlign(currentGist.lines).join("\n")
                };
                currentGist = null;
            } else if (currentGist && line.indexOf("gisthide") == -1) {
                currentGist.lines.push(line);
            }
            lineNo += 1;
        });
        if (currentGist) {
            throw new PluginError(PLUGIN_NAME, "Reached end of file but gist is still open");
        }
        if (mode == 'create') {
            return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                return Q.all(Object.keys(gists).map(function(id) {
                    return create(auth, gists[id]);
                }));
            }).done();
        } else if (mode == 'update') {
            return fs.read(getUserHome() + '/.gistauth', 'b').then(function (auth) {
                return Q.all(Object.keys(gists).map(function(id) {
                    return patch(auth, id, gists[id]);
                }));
            }).done();
        } else {
            gutil.log('Gist mock: ', gists);
        }
    });
}
453443
def _get_diff(self, cp_file):
        """"""
        diff = []
        self._create_sot_file()
        diff_out = self.device.show(
            'show diff rollback-patch file {0} file {1}'.format(
                'sot_file', self.replace_file.split('/')[-1]), raw_text=True)
        try:
            diff_out = diff_out.split(
                '#Generating Rollback Patch')[1].replace(
                    'Rollback Patch is Empty', '').strip()
            for line in diff_out.splitlines():
                if line:
                    if line[0].strip() != '!':
                        diff.append(line.rstrip(' '))
        except (AttributeError, KeyError):
            raise ReplaceConfigException(
                'Could not calculate diff. It\'s possible the given file doesn\'t exist.')
        return '\n'.join(diff)
104469
def diff(*args):
    """"""
    parser = argparse.ArgumentParser(prog="%s %s" % (__package__, diff.__name__), description=diff.__doc__)
    parser.add_argument('FILENAME', help="file(s) to show changes in", nargs="*", default=['.'])
    parser.add_argument('-U', '--unified', type=int, dest="NUM", default=3, action="store", help="number of lines of context to show")
    args = parser.parse_args(args)

    config = FragmentsConfig()

    for s, curr_path in _iterate_over_files(args.FILENAME, config, statuses='MAD'):
        key = os.path.relpath(curr_path, config.root)
        if key not in config['files']:
            yield "Could not diff '%s', it is not being followed" % os.path.relpath(curr_path)
            continue

        if s in 'MAD':
            repo_lines = []
            curr_lines = []
            if s in 'MA':
                with _smart_open(curr_path, 'r') as curr_file:
                    curr_lines = curr_file.readlines()
            if s in 'MD':
                repo_path = os.path.join(config.directory, config['files'][key])
                with _smart_open(repo_path, 'r') as repo_file:
                    repo_lines = repo_file.readlines()
            weave = Weave()
            weave.add_revision(1, repo_lines, [])
            weave.add_revision(2, curr_lines, [])
            for l in _full_diff(weave.merge(1, 2), key, context_lines=args.NUM):
                yield l
1216887
function commit() {
		console.log( "Adding files to dist..." );
		Release.exec( "git add -A", "Error adding files." );
		Release.exec(
			"git commit -m \"Release " + Release.newVersion + "\"",
			"Error committing files."
		);
		console.log();

		console.log( "Tagging release on dist..." );
		Release.exec( "git tag " + Release.newVersion,
			"Error tagging " + Release.newVersion + " on dist repo." );
		Release.tagTime = Release.exec( "git log -1 --format=\"%ad\"",
			"Error getting tag timestamp." ).trim();
	}
800050
function getDiffForPR(pr) {
  print(['Get diff for PR ', clc.yellow.bold(`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`)], debug);
  return new Promise((resolve) => {
    github.repos.compareCommits({
      user: pr.head.user.login,
      repo: pr.head.repo.name,
      head: pr.head.ref,
      base: pr.base.ref
    }, (err, diff) => {
      if (err && debug) {
        print(['Error fetching diffs for PR ', clc.red.bold`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`], debug);
      }
      diff.user = pr.head.user.login;
      diff.repo = pr.head.repo.name;
      diff.title = pr.title;
      diff.number = pr.number;
      diff.link = pr._links.html.href;
      diff.createdAt = pr.created_at;
      diff.createdAt = pr.updated_at;
      diff.labels = pr.labels;
      return resolve(extractDiffData(diff));
    });
  });
}
219252
def _create_diff(diff, fun, key, prev, curr):

    '''
    
    '''

    if not fun(prev):
        _create_diff_action(diff, 'added', key, curr)
    elif fun(prev) and not fun(curr):
        _create_diff_action(diff, 'removed', key, prev)
    elif not fun(curr):
        _create_diff_action(diff, 'updated', key, curr)
473074
def get_diff(original, fixed, file_name,
             original_label='original', fixed_label='fixed'):
    """"""
    original, fixed = original.splitlines(True), fixed.splitlines(True)
    newline = '\n'

    from difflib import unified_diff
    diff = unified_diff(original, fixed,
                        os.path.join(original_label, file_name),
                        os.path.join(fixed_label, file_name),
                        lineterm=newline)
    text = ''
    for line in diff:
        text += line
        # Work around missing newline (http://bugs.python.org/issue2142).
        if not line.endswith(newline):
            text += newline + r'\ No newline at end of file' + newline
    return text
1195109
def compare(self, base, head):
        
        assert isinstance(base, (str, unicode)), base
        assert isinstance(head, (str, unicode)), head
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/compare/" + base + "..." + head
        )
        return github.Comparison.Comparison(self._requester, headers, data, completed=True)
1312043
def get_diff(self, commit, other_commit):
        
        print(other_commit, "VS", commit)
        diff = self.repo.git.diff(commit, other_commit)
        return Diff(diff).get_totals()
773238
def put(self, file):
        
        input_ = {
            "message": file.logs,
            "author": file.author.dict(),
            "content": file.base64,
            "branch": file.branch
        }
        uri = "{api}/repos/{origin}/contents/{path}".format(
            api=self.github_api_url,
            origin=self.origin,
            path=file.path
        )
        data = self.request("PUT", uri, data=input_)

        if data.status_code == 201:
            file.pushed = True
            return file
        else:
            decoded_data = json.loads(data.content.decode("utf-8"))
            return self.ProxyError(
                data.status_code, (decoded_data, "message"),
                step="put", context={
                    "uri": uri,
                    "params": input_
                }
            )
994705
def diff model: nil, filter: nil
      cmd = 'git diff '
      if !model.nil? && model.downcase == 'cached'
        cmd = cmd + '--cached '
      end
      cmd = cmd + '--name-only '
      if !filter.nil?
        cmd = cmd + '--diff-filter=' + filter
      end
      `#{cmd}`.chomp.split
    end
832196
def update(self, file):
        
        params = {
            "message": file.logs,
            "author": file.author.dict(),
            "content": file.base64,
            "sha": file.blob,
            "branch": file.branch
        }
        uri = "{api}/repos/{origin}/contents/{path}".format(
            api=self.github_api_url,
            origin=self.origin,
            path=file.path
        )
        data = self.request("PUT", uri, data=params)
        if data.status_code == 200:
            file.pushed = True
            return file
        else:
            reply = json.loads(data.content.decode("utf-8"))
            return self.ProxyError(
                data.status_code, (reply, "message"),
                step="update", context={
                    "uri": uri,
                    "params": params
                }
            )