Patchwork [1,of,2,stable] largefiles: fix commit when using relative paths from subdirectory

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 25, 2013, 5:34 p.m.
Message ID <1fa7dfd609ffd5464d2a.1359135245@mk-desktop>
Download mbox | patch
Permalink /patch/735/
State Accepted
Commit 877f80599df02b3fe223dfddf96149fb3a9a1699
Headers show

Comments

Mads Kiilerich - Jan. 25, 2013, 5:34 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1359129574 -3600
# Branch stable
# Node ID 1fa7dfd609ffd5464d2aef473cb1191758b0e073
# Parent  e031e10cdc06a9708cd77f7518b6a6d817eeec10
largefiles: fix commit when using relative paths from subdirectory

Remove cwd handling from getstandinmatcher - it did not belong there, as proven
by the tests.

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -224,13 +224,7 @@ 
     '''Return a match object that applies pats to the standin directory'''
     standindir = repo.wjoin(shortname)
     if pats:
-        # patterns supplied: search standin directory relative to current dir
-        cwd = repo.getcwd()
-        if os.path.isabs(cwd):
-            # cwd is an absolute path for hg -R <reponame>
-            # work relative to the repository root in this case
-            cwd = ''
-        pats = [os.path.join(standindir, cwd, pat) for pat in pats]
+        pats = [os.path.join(standindir, pat) for pat in pats]
     elif os.path.isdir(standindir):
         # no patterns: relative to repo root
         pats = [standindir]
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1842,6 +1842,34 @@ 
   .hglf/large.dat
   .hglf/large2.dat
 
+Test actions on largefiles using relative paths from subdir
+
+  $ mkdir sub
+  $ cd sub
+  $ echo anotherlarge > anotherlarge
+  $ hg add --large anotherlarge
+  $ hg st
+  A sub/anotherlarge
+  $ hg st anotherlarge
+  A anotherlarge
+  $ hg commit -m anotherlarge anotherlarge
+  Invoking status precommit hook
+  A sub/anotherlarge
+  $ hg log anotherlarge
+  changeset:   1:9627a577c5e9
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     anotherlarge
+  
+  $ echo more >> anotherlarge
+  $ hg st .
+  M anotherlarge
+  $ hg revert anotherlarge
+  $ hg st
+  ? sub/anotherlarge.orig
+  $ cd ..
+
   $ cd ..
 
 issue3651: summary/outgoing with largefiles shows "no remote repo"