def shelf_diff_simple(sbox):
  "shelf diff simple"

  sbox.build()
  was_cwd = os.getcwd()
  os.chdir(sbox.wc_dir)
  sbox.wc_dir = ''
  wc_dir = sbox.wc_dir

  def setup(sbox):
    sbox.simple_propset('p1', 'v', 'A/mu')
    sbox.simple_propset('p2', 'v', 'A/mu')

  def modifier1(sbox):
    sbox.simple_rm('A/B/lambda')
    sbox.simple_add_text('This is a new file.\n', 'A/B/new')
    sbox.simple_append('A/mu', 'New line.\n')
    sbox.simple_propset('p1', 'changed', 'A/mu')

  setup(sbox)
  sbox.simple_commit()
  initial_state = get_wc_state(wc_dir)

  # Make some changes to the working copy
  modifier1(sbox)
  modified_state = get_wc_state(wc_dir)

  svntest.actions.run_and_verify_svn(None, [],
                                     'x-shelf-save', 'foo')

  # basic svn-style diff
  expected_output = make_diff_header('A/B/lambda', 'revision 2', 'nonexistent') + [
                      "@@ -1 +0,0 @@\n",
                      "-This is the file 'lambda'.\n"
                    ]
  expected_output += make_diff_header('A/B/new', 'nonexistent', 'working copy') + [
                      "@@ -0,0 +1 @@\n",
                      "+This is a new file.\n"
                    ]
  expected_output += make_diff_header('A/mu', 'revision 2', 'working copy') + [
                      "@@ -1 +1,2 @@\n",
                      " This is the file 'mu'.\n",
                      "+New line.\n",
                    ] + make_diff_prop_header('A/mu') \
                    + make_diff_prop_modified('p1', 'v', 'changed')
  svntest.actions.run_and_verify_svn(expected_output, [],
                                     'x-shelf-diff', 'foo')

  # basic summary diff
  expected_diff = svntest.wc.State(wc_dir, {
    'A/B/lambda':     Item(status='D '),
    'A/B/new':        Item(status='A '),
    'A/mu':           Item(status='MM'),
  })
  run_and_verify_shelf_diff_summarize(expected_diff, 'foo')
Exemple #2
0
def shelf_diff_simple(sbox):
    "shelf diff simple"

    sbox.build()
    was_cwd = os.getcwd()
    os.chdir(sbox.wc_dir)
    sbox.wc_dir = ''
    wc_dir = sbox.wc_dir

    def setup(sbox):
        sbox.simple_propset('p1', 'v', 'A/mu')
        sbox.simple_propset('p2', 'v', 'A/mu')

    def modifier1(sbox):
        sbox.simple_append('A/mu', 'New line.\n')
        sbox.simple_propset('p1', 'changed', 'A/mu')

    setup(sbox)
    sbox.simple_commit()
    initial_state = get_wc_state(wc_dir)

    # Make some changes to the working copy
    modifier1(sbox)
    modified_state = get_wc_state(wc_dir)

    svntest.actions.run_and_verify_svn(None, [], 'shelf-save', 'foo')

    # basic svn-style diff
    expected_output = make_diff_header('A/mu', 'revision 2', 'working copy') + [
                        "@@ -1 +1,2 @@\n",
                        " This is the file 'mu'.\n",
                        "+New line.\n",
                      ] + make_diff_prop_header('A/mu') \
                      + make_diff_prop_modified('p1', 'v', 'changed')
    svntest.actions.run_and_verify_svn(expected_output, [], 'shelf-diff',
                                       'foo')

    # basic summary diff
    expected_output = ['MM      A/mu\n']
    svntest.actions.run_and_verify_svn(expected_output, [], 'shelf-diff',
                                       '--summarize', 'foo')